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
 Technical Support
 "Move to Source" moves to wrong file
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

dewtell
Junior Member

18 Posts

Posted - Jun 14 2011 :  2:36:08 PM  Show Profile  Reply with Quote
When doing a "move to source file" refactoring from foo.h, if there is no foo.cpp in the same directory, but there is a foo.cpp or Foo.cpp elsewhere in the solution, the code will probably be moved there. I ran into this with one file, and needed to restart Visual Studio (after creating foo.cpp in the correct directory) in order to break the link to the wrong file.

This is with Visual Assist X version 10.6.1850.0 and Visual Studio 2008, Professional Edition.

feline
Whole Tomato Software

United Kingdom
18958 Posts

Posted - Jun 14 2011 :  3:24:03 PM  Show Profile  Reply with Quote
I am not quite sure what to say here. If the correct destination file does not exist when you initially trigger Move Implementation to Source File then VA obviously cannot use this file, so VA did its best.

Once you have added the file to the solution, you have to save the solution before VA will learn about the new file, since we read the solution file from the hard drive, not from memory. Reloading the IDE will save the solution and let VA learn about the new, matching file, but doing a "File -> Save All" should also help.

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

dewtell
Junior Member

18 Posts

Posted - Jun 14 2011 :  3:58:09 PM  Show Profile  Reply with Quote
Well, I'd like it to at least be able to warn me that (in this case) it's about to move the code to a potentially completely unrelated file (in this case, it took a core engine .h file and moved the code to a GUI file with the same name/different case). I suppose this warning should be configurable, for people who intend to keep their .h and .cpp files in different directories, but I think the default should be to warn.

In this case, I created the correct .cpp file by using cmake, which rebuilt the solution file on disk. So Visual Studio did re-read the updated solution file from disk, and Visual Assist still kept trying to move the code to the wrong file until I completely got out of Visual Studio and restarted it from scratch.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Jun 14 2011 :  8:10:19 PM  Show Profile  Reply with Quote
The problem is that how you define a "completely unrelated file". We have made several improvements on how alt+o works (switching between related files) and through this process I have seen a lot of "odd" variations about where people tend to keep their corresponding files. Not everyone keeps the corresponding files in the same directory to say the least. A warning that may be inappropriate, may break the flow and may cause more frustration / distraction than benefit.

Personally, I always create the corresponding files at the same time to avoid problems like this or others.

Anyway, VA usually does a very good job at catching up changes, including file creations. However, in this case VA "caches" the file location it found, for some reason. Normally this shouldn't cause any inconvenience. Is this a frequent problem you run into?

Edited by - accord on Jun 14 2011 8:18:01 PM
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