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: Extract expression / extract constant
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

peterchen
Tomato Guru

126 Posts

Posted - Jul 17 2008 :  1:03:58 PM  Show Profile  Reply with Quote
A feature that I am missing regulary is this to extract an selected subexpression as a variable.

In the code

key = CxGetProfileString(file, _T("Section"), _T("key"));


I select the _T("Section"), and select "extract expression" from the refactoring context menu.

I am asked for name and type of the variable. If I enter "section", the code gets changed to this:

LPCTSTR section = _T("Section");
key = CxGetProfileString(file, section, _T("key"));


Suggestion: keep type and name in one long edit field, rather than requiring two

Bonus: Make a good suggestion for the type
Bonus: optionally allow replacing the expression in the current function/file/project. (IMO project is dangerous, but people will want it).
Bonus: move the extracted assignment to a suitable location depending on the "replace" option

Caret position after input would probably be the beginning of the newly inserted line, since the most likely action is moving the declaration somewhere. Alt-Back takes me back to the start of the replaced expression.

This would be very Very VERY helpful even without the replace.



feline
Whole Tomato Software

United Kingdom
18958 Posts

Posted - Jul 17 2008 :  2:17:38 PM  Show Profile  Reply with Quote
We are considering adding a refactoring command to extract a piece of code and turn it into a variable:

case=1492

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

peterchen
Tomato Guru

126 Posts

Posted - Jul 29 2008 :  05:06:10 AM  Show Profile  Reply with Quote
Go to Top of Page

sean
Whole Tomato Software

USA
2817 Posts

Posted - Nov 07 2014 :  10:08:01 AM  Show Profile  Reply with Quote
case=1492 is implemented in build 2052
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