T O P I C R E V I E W |
bwinter |
Posted - Feb 21 2011 : 03:34:08 AM The codestyle of my company requires a space between a method name and (). [C++] So I have turned on the option "Insert () and closing ... and put 1 spaces between method name and ().
After using "Extract method" the remaining method call does not have this space.
Example: callMethod (withArgument ());
after "Extract method": newMethod(); <-- no space in between
void Foo::newMethod () { callMethod (withArgument ()); }
VA_X.dll file version 10.6.1842.0 built 2011.02.03 Licensed to: VA X: --- (31-user license) Support ends 2012.03.31 DevEnv.exe version 9.0.30729.1 Professional msenv.dll version 9.0.30729.1 Font: Courier New 13(Pixels) Comctl32.dll version 6.10.7600.16661 Windows 7 6.1 Build 7600 4 processors (x86-64; WOW64)
Platform: Win32 Stable Includes: C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\include; C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\include; C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\include; C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\include;
Other Includes:
Stable Source Directories: C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\src\\mfc; C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\src\\mfcm; C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\atlmfc\\src\\atl; C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\crt\\src;
|
4 L A T E S T R E P L I E S (Newest First) |
bwinter |
Posted - Feb 23 2011 : 02:43:17 AM Thank you for clarifying this.
I will have a look at some formatting tools or just accept the manual correction. |
feline |
Posted - Feb 22 2011 : 3:08:15 PM Unfortunately you cannot configure the formatting of the new function call created by Extract Method. We have discussed more extensive code formatting, but it is a tricky area, partly due to the very large number of options it would require.
Have you considered using a separate tool that specialises in code formatting? This is one example, but I have never used it personally so I don't know how well it actually works:
http://www.profactor.co.uk/stylemanager.php |
bwinter |
Posted - Feb 21 2011 : 09:47:22 AM Thank for your reply accord.
I already have adjusted the refactoring snippets, but I cannot find anything for defining the leftover call of the extracted method.
Updated example: void Foo::bar () { callMethod (withArgument ()); <-- use extract method on this line }
after "Extract method": void Foo::bar () { newMethod(); <-- no space in between }
void Foo::newMethod () { callMethod (withArgument ()); } |
accord |
Posted - Feb 21 2011 : 08:50:58 AM Refactorings have its own snippets which you can edit so you can use your styles. To open the snippet editor, just select VAssistX -> Tools -> Edit VA Snippets...
Here, open the treenode for your language (e.g. C++, C#) and find the snippet "Refactor Extract Method". You will also find other snippets for other refactorings near this one. |