Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Over with parameters, expand them into code

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
John_H_Bergman Posted - Aug 30 2006 : 01:09:48 AM
More on psuedo refactoring.

lets say I get the popup that has the function definition, with the parameters like fn(int top, int bottom, bool something).

I'd like to be able to push those into the current function I am calling inside the code... I've noticed that when I code I try to use the same variable names (or close to it) consistently so the code is easier to follow... (iTop, iBottom, etc)... this could save CONSIDERABLE typing.
5   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Sep 05 2006 : 4:54:33 PM
i have put in a feature request for the developers to consider at some point, summarising all of this.

case=2379
John_H_Bergman Posted - Sep 05 2006 : 11:45:44 AM
i know a bit about C# but not enough to be sure here. am i correct in saying C# has overloaded operators, but no default parameters?

Yep.

i am inclined to suggest do not add parameters for the default parameters.

I would tend to agree, you could always circle back and add some sort of configuration option for this.

but how can you trigger this without the mouse? as soon as i press the ALT key to access the VAssistX menu the tooltip disappears.

You could add a button in the tooltip window, or even allow double-click to do it... Not sure how you would do it without using the mouse; Is there a way to always use the VA tooltip for this type of information?

i think i am back to having to ask the user which overload they want to use when they trigger this refactoring, totally ignoring the tooltip.

That would be a find start, perhaps a window appears when you press the opening parenthesis?
feline Posted - Sep 04 2006 : 5:25:21 PM
*blush* this is why copy and paste is such bad practice! see, let this "deliberate" mistake lesson to you all!

i know a bit about C# but not enough to be sure here. am i correct in saying C# has overloaded operators, but no default parameters?

triggering this could be a little tricky. in general VA's approach to tooltips is to wait and see if the IDE produces one, and if it does not VA then jumps in and produces one.

most of the time the parameter tooltip (CTRL-SHIFT-SPACE) is produced by VA, but i would be loath to guarantee that VA was producing this tooltip 100% of the time. having said that VA does know what text is displayed, since it makes the current parameter bold.

as soon as you want to use the mouse to trigger this refactoring you have the problem of the VA refactoring tooltip having to co-exist with the parameter tooltip, without the two overlapping. we have had problems with overlapping tooltips in earlier beta builds, so this cannot simply be ignored.

but how can you trigger this without the mouse? as soon as i press the ALT key to access the VAssistX menu the tooltip disappears.

i think i am back to having to ask the user which overload they want to use when they trigger this refactoring, totally ignoring the tooltip.

since we want to keep the number of questions to an absolute minimum we could do with some sort of sensible behaviour for default parameters that avoids having to ask questions. rather than ignore the defaults and add a variable for every parameter i am inclined to suggest do not add parameters for the default parameters.

this idea seems to cover what you are looking for. so what problem cases have i missed? what about function pointers as parameters? or even simply pointers?
John_H_Bergman Posted - Sep 04 2006 : 12:50:36 AM
first rather obvious problem is what about overloaded functions and default parameters

Ya, in the C++ world that could be a problem. C#, not so much so. As for which one to expand, I would expand the one that his shown in the tooltop (since if there are more than one, I can select the right one).

Of course int top, left... you really wouldn't put int in the list of parameters ;-).

feline Posted - Sep 02 2006 : 1:30:21 PM
i am not sure i follow, but this is what i am thinking:

given the code:

bool getWindowPosition(int &top, int &left, int &height, int &width) { ... }

void saveSettings()
{
    if(getWindowPosition(|)
    {
    }
}


here VA will be showing the tooltip for the four parameters. you are looking for something like place the caret into the function name "getWindowPosition" and trigger a refactoring that turns the code into this:

void saveSettings()
{
    int top, left, height, width;
    if(getWindowPosition(int top, left, height, width)
    {
    }
}


i can see a certain appeal to this. i am just wondering how likely this is to run into nasty problems.

the first rather obvious problem is what about overloaded functions and default parameters?

for the overload VA is going to have to ask which overload you want to call. the default parameters present a different problem, since no matter what VA does someone is bound to want something else

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000