Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Refactor to make new Type

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
Greg Posted - Jun 19 2008 : 10:17:52 PM
Had a quick search of the forum and couldn't seem to locate a current thread on the topic. Sorry if this is a duplicate.

Sometimes I'll make a quick inline template while identifying a member variable.
	std::vector<wxString> m_captions;


I'd like to be able to refactor the type into a new named type so that I can work with it more easily.

Is there a standard refactoring for this -
basically turn it into a typedef
	typedef std::vector<wxString> Captions;
	Captions m_captions;


4   L A T E S T    R E P L I E S    (Newest First)
sean Posted - Jun 23 2008 : 9:57:57 PM
Nice snippet - but you need a prompt for the new name:


typedef $selected$ $newTypeName$;
$newTypeName$

feline Posted - Jun 23 2008 : 08:50:27 AM
Assuming you have added the VA Snippet select the type in your code:



then press the "Insert VA Snippet" button on the VA toolbar and select the snippet "convert to typedef".

You cannot simply define a new refactoring command by adding a snippet since VA would not know what the refactoring command was supposed to do.
Greg Posted - Jun 22 2008 : 11:37:55 PM
Thanks Feline, mostly there, I was thinking something more like the following - though I don't know enough to get this to work as a selection, if I put this in the Encapsulate field refactoring I get more like what I'm after.

typedef $SymbolType$ $GeneratedPropertyName$;
$GeneratedPropertyName$ $SymbolName$; $end$

It appears you can't just add new refactorings?
feline Posted - Jun 20 2008 : 4:07:37 PM
You can do this with VA Snippets. I have just created a new snippet with the code:

typedef $selected$;
$selected$ $end$


In your original line select the type:

std::vector<wxString> m_captions;

and then just insert this new "convert to typedef" snippet.

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