Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Over with parameters, expand them into code
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

John_H_Bergman
Tomato Guru

USA
198 Posts

Posted - Aug 30 2006 :  01:09:48 AM  Show Profile  Reply with Quote
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.

John H. Bergman
CTO
SiliconZone


[email protected]

To Send email, remove the .online.

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Sep 02 2006 :  1:30:21 PM  Show Profile  Reply with Quote
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

zen is the art of being at one with the two'ness

Edited by - feline on Sep 02 2006 1:31:39 PM
Go to Top of Page

John_H_Bergman
Tomato Guru

USA
198 Posts

Posted - Sep 04 2006 :  12:50:36 AM  Show Profile  Reply with Quote
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 ;-).


John H. Bergman
CTO
SiliconZone


[email protected]

To Send email, remove the .online.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Sep 04 2006 :  5:25:21 PM  Show Profile  Reply with Quote
*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?

zen is the art of being at one with the two'ness
Go to Top of Page

John_H_Bergman
Tomato Guru

USA
198 Posts

Posted - Sep 05 2006 :  11:45:44 AM  Show Profile  Reply with Quote
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?

John H. Bergman
CTO
SiliconZone


[email protected]

To Send email, remove the .online.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Sep 05 2006 :  4:54:33 PM  Show Profile  Reply with Quote
i have put in a feature request for the developers to consider at some point, summarising all of this.

case=2379

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000