Author |
Topic |
|
TorbenKoch
Junior Member
20 Posts |
Posted - Aug 28 2007 : 05:24:32 AM
|
When using ALT-O to change between header and implementation Visual Assist gets confused if there are more files with the same name, even if they are in other projects.
Like this:
Project 1: Myfile.h Myfile.cpp
Project 2: Myfile.h Myfile.cpp
Visual Assist cannot figure out the correct relationship between these files. I can live with the fact that ALT-O simply shows all the files and leaves it up to me to choose.
The real problem comes when I in Project 1/Myfile.h choose the Refactor/Create Implementation for a method. Visual Assist here - consistently - chooses to implement the method in Project 2/Myfile.cpp, which ofcourse is silly.
To make this even more wierd: In Project 2 the Myfile.h and Myfile.cpp are enclosed in another namespace than in Project 1.
Hope this description is clear. |
|
feline
Whole Tomato Software
United Kingdom
19019 Posts |
Posted - Aug 28 2007 : 08:14:43 AM
|
VA should get this right so long as all 4 files have been added to the solution.
Can you try adding these 4 files to the solution again. The IDE should detect that they are already present, and not do anything.
Are you able to post the full path names of these files?
Which IDE are you using? |
zen is the art of being at one with the two'ness |
|
|
TorbenKoch
Junior Member
20 Posts |
Posted - Aug 28 2007 : 09:09:33 AM
|
Yeah, sorry about that ;-)
Using Visual Studio 2005.
I'll have to obfuscate the filenames a little:
Parent path:
D:\\Development\\Projects\\OurProject\ Paths of the files, with a namespace: Sources\\Project1\\Config\\Documents\\Myfile.h Sources\\Project1\\Config\\Documents\\Myfile.cpp
Paths of the files without a namespace: Sources\\Project2\\API\\Config\\Documents\\Myfile.h Sources\\Project2\\Config\\Documents\\Myfile.cpp
There are, obviously, some similarities in the paths, but the fact that the files belong to different projects in Visual Studio (and they are added to the projects, just checked) ought to clear out any misunderstandings for Visual Assist.
I have readded the files, which did not solve the problem.
To clarify: If I choose Create Implementation in "Sources\\Project2\\API\\Config\\Documents\\Myfile.h" Visual Assist chooses to implement it in "Sources\\Project1\\Config\\Documents\\Myfile.cpp". Weird |
|
|
feline
Whole Tomato Software
United Kingdom
19019 Posts |
Posted - Aug 28 2007 : 12:41:33 PM
|
Lets focus on the alt-o part of this problem first. using VS2005 and VA 1559 I have two separate projects in a single solution, with the 4 files:
project 1 c:\\src\\ManualVaTests\\tests\\test_duplicate_alt_o.cpp c:\\src\\ManualVaTests\\tests\\test_duplicate_alt_o.h
project 2 c:\\src\\ManualVaTests\\tests\\dll_files\\test_duplicate_alt_o.h c:\\src\\ManualVaTests\\tests\\dll_files\\test_duplicate_alt_o.cpp
I am not seeing any problems with alt-o, VA always takes me to the correct file directly, without asking me where to go.
If you close all open cpp and .h files, and then open the OFIW dialog, are all 4 files listed? I don't see anything about these paths to suggest a problem. |
zen is the art of being at one with the two'ness |
|
|
TorbenKoch
Junior Member
20 Posts |
Posted - Aug 29 2007 : 02:23:14 AM
|
Yes, all 4 files are in the OFIW dialog. Also after a restart of the IDE. And Visual Assist consistently shows the list with all four files when ALT-O'ing.
Project 1 consists of about 540 files (.h + .cpp) and Project 2 of about 320 files. This does not seem excessive to me.
The ALT-O issue is of course annoying, but not a huge problem. The real bother is the Create Implementation issue, but I guess they are part of the same problem. Will it help you if I enable logging and send the resulting logfile to you? And if, on what parts of the process should I enable logging? |
|
|
xmichelo
New Member
3 Posts |
Posted - Aug 29 2007 : 04:48:02 AM
|
I also encountered the problem, with to pair of files with the same name in two different projects. I got a popup from VA with the 4 files. |
|
|
feline
Whole Tomato Software
United Kingdom
19019 Posts |
Posted - Aug 29 2007 : 10:07:42 AM
|
I am making some progress. After setting up two pairs of files, in a directory structure much closer to TorbenKoch's I am seeing the alt-o menu appear, even though all 4 files have been added to the two solutions correctly:
case=8429
However I cannot reproduce any problems with Create Implementation, which suggests the trigger is a little different.
TorbenKoch is there anything else "odd" about these files, that might offer a clue as to why Create Implementation ends up using the wrong file? I am wondering if somehow the namespaces are effecting things. |
zen is the art of being at one with the two'ness |
|
|
TorbenKoch
Junior Member
20 Posts |
Posted - Aug 30 2007 : 02:19:03 AM
|
Well, the only "odd" thing is that the implementation in the files look a-like, e.g same class name and some methods overlap, as well. And in one project the class have been enclosed in a namespace.
I'm glad you're making progress. I'm almost starting to get used to it after creating an implementation in the wrong place a few dozen times ;-) |
|
|
TorbenKoch
Junior Member
20 Posts |
Posted - Aug 30 2007 : 02:24:05 AM
|
Another thing: The files with the namespace started out as copies of the files without namespace. The namespace was added later.
I have just a Rebuild symbols/Restart IDE - this did not have any effect, though. |
|
|
feline
Whole Tomato Software
United Kingdom
19019 Posts |
Posted - Aug 30 2007 : 07:39:54 AM
|
When you have the namespace, in the cpp file how are you accessing the namespace? Do you have a "using namespace foo" at the top of the file? Is the entire file wrapped in "namespace foo { ... }"?
I am still not able to reproduce this problem.
Can you try copy / pasting the following code to the *top* of these two header files and then run Create Implementation on the functions, and see what happens?
Into the header with the namespace add:
namespace SPACE_SCATTERED_DLL_PROJECT
{
class CScatteredDuplicate
{
CScatteredDuplicate();
int getSize();
int getCount();
char *getName();
void setName(const char *strName);
};
}
and into the header without the namespace add:
class CScatteredDuplicate
{
CScatteredDuplicate();
int getSize();
int getCount();
char *getName();
void setName(const char *strName);
};
I am wondering if this will work correctly, or show the same bug. I am wondering if there is something about these files that is encouraging this problem, but if so, what? |
zen is the art of being at one with the two'ness |
|
|
TorbenKoch
Junior Member
20 Posts |
Posted - Sep 03 2007 : 10:13:28 AM
|
I tried your suggestion and did I get confused!
I have trouble describing what happens, because it is rather weird and not entirely consistent.
The results also depend on whether you in the cpp file types:
namespace SPACE_SCATTERED_DLL_PROJECT {
}
before using the Create Implementation. In this case it seems to worksfor the namespaced version, but the other one still fails.
Forgive me for not being able to describe this more precisely, but the behaviour is simply not consistent. |
|
|
feline
Whole Tomato Software
United Kingdom
19019 Posts |
Posted - Sep 03 2007 : 2:39:03 PM
|
I do dislike random bugs. Lets try this. I have just created a very simple test solution, VS2005 format, holding two projects and the two pairs of duplicate files:
http://forum.wholetomato.com/colin/forumimages/6593_alt_o_testing.zip
Can you try downloading this project and see if you can reproduce the problem by making it look more like your main project?
Currently there are no namespaces in these files, since this is just a simple test.
This way we can both use the same test project, make the same changes to it, and send files back and forward without any concern. So if between us we can make this go wrong, hopefully we can make it go wrong on demand.
On my system this project is placed in the directory "C:\\src_2005\\", so I end up with the file:
C:\\src_2005\\alt_o_testing\\alt_o_testing.sln |
zen is the art of being at one with the two'ness |
|
|
TorbenKoch
Junior Member
20 Posts |
Posted - Sep 06 2007 : 05:51:02 AM
|
Sorry for not getting back to you sooner.
I downloaded your solution and ALT-O fails on all four test_xxxxx files by showing the list with the other three files.
The Create Implementation succeeds in find the right file, though.
I will do some test with namespaces etc. and get back to you. |
|
|
feline
Whole Tomato Software
United Kingdom
19019 Posts |
Posted - Sep 06 2007 : 12:48:02 PM
|
You are seeing the same thing I am, which is a good start
It will be interesting to see if you can reproduce the problem in this simplified project. |
zen is the art of being at one with the two'ness |
|
|
TorbenKoch
Junior Member
20 Posts |
Posted - Sep 12 2007 : 11:08:01 AM
|
No, sorry.
No matter how many variations I try on the sample project, Create Implementation always gets it right. Weird.
I will get back to you if I figure something out. |
|
|
feline
Whole Tomato Software
United Kingdom
19019 Posts |
Posted - Sep 13 2007 : 08:38:45 AM
|
This rather suggests that the problem is triggered by something else.
Are you able to add the test files into your main solution, and then test then that way? You probably want to run such a test on a copy of the main solution, to avoid any possible problems.
I am wondering if there are other files or classes in the main solution that are confusing VA, and thus required to trigger this problem. I don't know what these files or classes might be, but it would explain why neither of us can reproduce this in the current simplified test project. |
zen is the art of being at one with the two'ness |
|
|
support
Whole Tomato Software
5566 Posts |
Posted - Oct 29 2007 : 02:25:23 AM
|
case=8429 is fixed in Build 1614 |
|
|
|
Topic |
|