Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Refactor: extract class to file(s)

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
borgman Posted - Jul 29 2008 : 6:01:20 PM
there is a lot of tedious, error-prone grunt work to pulling a class out of one file, creating an appropriately named file for the extracted class, pulling over appropriate includes, Header, .cpp, namespacing ... ugh!!!

It seems like you guys already have all the information to make this refactoring easy.

What are the chances?
5   L A T E S T    R E P L I E S    (Newest First)
borgman Posted - Aug 04 2008 : 10:51:34 AM
Yah, I've got some class templates similar to what you've suggested. The Unit Testing template is especially popular.

We've got a lot of legacy code where pulling out classes adds a lot of tedium.

Thanks all.
Krakken Posted - Aug 04 2008 : 04:00:46 AM
Unfortunately I lost that macro a while back. To create the new files there's:

DTE.ItemOperations.NewFile("Visual C++\\Header File (.h)")
DTE.ItemOperations.NewFile("Visual C++\\C++ File (.cpp)")

The rest is standard stuff. If you get stuck with any of the commands I always just CTRL+SHIFT+R (record macro) perform the action then CTRL+SHIFT+R again (stop recording) and check the generated code in the temporary macro.

File loading will have to be written manually in the VBScript. Good luck! :)
GennadiyKorol Posted - Aug 01 2008 : 1:56:21 PM
Krakken:

I was about to start writing the exactly the same macro for adding new class files to the project. If it's not too NDA'ish, could you please share your version?

Thanks!
Krakken Posted - Jul 31 2008 : 7:48:00 PM
borgman, you can do most of the grunt work in a customised way by using Visual Studio macros. I used to have one that would prompt me for the name of the class, create two new files with the appropriate name and fill the files out with a pre-defined template for me. You can load these templates from file and replace certain keywords or just have the macro generate it. All I had to do then was to click "Save" and I would be prompted by the IDE asking where to save the file. Saved me a lot of time, I should probably re-make it TBH.

As for VAX, this could be done in the same way and as snippets improve their variable database, could be customised quite nicely. There is no need for VAX to save the file, that can be a quick, manual process.
feline Posted - Jul 30 2008 : 08:40:15 AM
Automatically adding files to the solution is not going to happen. There are several reasons, including not knowing which directory to use, which project to use, and source control for this.

Have you tried using VA Outline to cut the items you want to move from the original file, so you can simply paste them into the target file?

This is not quite the same, but it should help.

Without a better understanding of what you are trying to do I am wary of saying anything more. Normally I create classes in individual files to start with, so I don't normally have to move them to a new file.

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