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 to make new Type
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Greg
New Member

Australia
6 Posts

Posted - Jun 19 2008 :  10:17:52 PM  Show Profile  Reply with Quote
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;


feline
Whole Tomato Software

United Kingdom
18950 Posts

Posted - Jun 20 2008 :  4:07:37 PM  Show Profile  Reply with Quote
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.

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

Edited by - feline on Jun 20 2008 4:08:23 PM
Go to Top of Page

Greg
New Member

Australia
6 Posts

Posted - Jun 22 2008 :  11:37:55 PM  Show Profile  Reply with Quote
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?
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18950 Posts

Posted - Jun 23 2008 :  08:50:27 AM  Show Profile  Reply with Quote
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.

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

sean
Whole Tomato Software

USA
2817 Posts

Posted - Jun 23 2008 :  9:57:57 PM  Show Profile  Reply with Quote
Nice snippet - but you need a prompt for the new name:


typedef $selected$ $newTypeName$;
$newTypeName$

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