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
 Feature Requests
 Refactor: Add Field to class
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

grandchain
Junior Member

United Kingdom
22 Posts

Posted - May 14 2008 :  06:13:00 AM  Show Profile  Reply with Quote
Hi,

I quite often find myself adding a field to a class when writing a bit of code, and then having to go to the class and remember exactly what I'd called it. It would be really neat to have a Refactoring of Add Field to Class/Structure so I could right-click on the new field and have it done for me.

For example:

typedef struct foo
{
int x;
} foo;

int func()
{
foo f;

f.y = 14; // I'm working, so I've just realised I need a field y in foo.
// I'd like to click on the y and be able to have it added for me.
}

Obviously in this example it's pretty trivial, but quite often the declaration is in another file in the middle of a rather larger structure, and the field name is rather longer since it's a meaningful name.

Cheers,

Ian

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - May 14 2008 :  1:41:36 PM  Show Profile  Reply with Quote
This is an interesting idea. I am just not sure what to make of it. I like the idea on paper, but one immediate concern is that the variable type is unknown. There have been a few recent discussions about VA trying to infer the type of an unknown variable. This should work some of the time, but there are edge cases that VA is going to struggle with.

I have asked internally about this, to see what people think about it.

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

grandchain
Junior Member

United Kingdom
22 Posts

Posted - May 15 2008 :  04:18:07 AM  Show Profile  Reply with Quote
Hi feline,

> one immediate concern is that the variable type is unknown.

I'd be happy with a pop-up that asks me the type (like Change Signature) if VA can't infer it.

Cheers,

Ian
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - May 15 2008 :  08:41:33 AM  Show Profile  Reply with Quote
There is some discussion about VA trying to work out the type of a new, undeclared variable in this thread:

http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=7190

The same points apply here. Popping up a dialog with VA's best guess might work well.

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