T O P I C R E V I E W |
GregDude |
Posted - Nov 19 2012 : 11:37:01 PM I notice ALT-G and the menu of Goto locations incorrectly identifies symbols with the same name.
Say you have a namespace containing a class called 'System' eg. My::System. Then code accesses this eg. My::System::StaticFunc(). Cursor over 'System', or ALT-G may not show your class, instead it shows 'namespace System' which may be from Microsoft .Net or other source.
I'd like it to show my symbol first, since it is #included in that .cpp file and if appropriate, show other potential matching symbols.
Note that the source code for symbols I want to see is in the same visual studio solution and directly included by the source files in question. |
8 L A T E S T R E P L I E S (Newest First) |
GregDude |
Posted - Nov 23 2012 : 4:40:51 PM quote: How do you close the scope? With a '}', or with a macro? If with a macro: what is the content of this macro?
I do use a second macro with '}', so the set looks like BEGIN_NAMESPACE_MY, END_NAMESPACE_MY. I use these for a few different namespaces, and when the problem was occurring the other ones were fine. I did check this as this forum mentioned a very old bug relating to namespaces in macros.
Thanks for your support. I realize it is very difficult to track an issue without a repro case and a simple one at that. I posted anyway in case other uses had similar issues and we might find a pattern, or you might suggest something I hadn't tried. |
accord |
Posted - Nov 23 2012 : 11:35:45 AM Thank you for the follow-up.
Rebuild symbol databases would have also been my bet, since the problem is gone, so it may be that something wasn't properly parsed? But since you have already tried this with no avail, it might be related to a code change? My bet now is that it might be macro related but I'm not sure. #defining "namespace My {" is clean and simple. How do you close the scope? With a '}', or with a macro? If with a macro: what is the content of this macro? |
GregDude |
Posted - Nov 22 2012 : 5:27:05 PM quote: Originally posted by accord
- What happens if you press alt+shift+s in the editor (or use VAssistX -> Find Symbol...) and type system and tick the checkbox only classes, structs & namespaces? Does Visual Assist find anything? If yes, where pressing enter takes you? - How do you include this file, where your class "System" is defined? Is it part of your project or just included as an external file? - If you press alt+shift+o (VAssistX -> Open file in solution...) and type the name of the file where the class "System" is defined, does Visual Assist find it? - Do you use any complex macros in your code? (e.g. recursive ones or macros that creates code: class or members, etc.) - Is your solution contains more than one project? What other project types are you using? Are any of these .net projects?
quote: 'namespace System' appears in the Goto locations dropdown bar.
Do you mean the dropdown next to the green Goto icon? When VA shows 'namespace system', what happens if you press the down arrow? Does VA list your class as well?
I can't repro any more... It's working perfectly now in every referencing file. Alt-G brings up 3 choices, .cpp, .h and .h constructor. I have made a bunch of code changes in the mean time, not specifically related to that code.
I'll answer some of your questions anyway.
I did the the alt+shift+s when it wasn't working. I can't recall the exact result, but I think I found the symbol in the list after narrowing search.
Alt-Shift-O always showed the file in the list.
I don't use complex macros, but the namespace System is in is a Macro simply #defining 'namespace My {' and the like.
I include the file in the standard way: .cpp file #include "mysystem.h". The source files mysystem.cpp,.h are part of another project in the same solution and different disk folder.
Yes, the 'goto' drop down is the text window and drop down box beside the 'GO' with green arrow. It usually shows the origin of the symbol under the cursor and allows drop down with one or more items. It simply showed 'namespace System' and nothing else. Clicking 'GO' made a ping sound and did nothing. Normally it jumps to the code location shown in the box.
The solution contains 14 projects, all native C++ static libraries and one to build an executable.
The first thing I did when noticing this issue was rebuild the VAX database as that often fixes problems for me. It had no effect with this issue.
I'll add to this thread in future when the problem returns and if I can learn something new. |
accord |
Posted - Nov 22 2012 : 4:28:56 PM - What happens if you press alt+shift+s in the editor (or use VAssistX -> Find Symbol...) and type system and tick the checkbox only classes, structs & namespaces? Does Visual Assist find anything? If yes, where pressing enter takes you? - How do you include this file, where your class "System" is defined? Is it part of your project or just included as an external file? - If you press alt+shift+o (VAssistX -> Open file in solution...) and type the name of the file where the class "System" is defined, does Visual Assist find it? - Do you use any complex macros in your code? (e.g. recursive ones or macros that creates code: class or members, etc.) - Is your solution contains more than one project? What other project types are you using? Are any of these .net projects?
quote: 'namespace System' appears in the Goto locations dropdown bar.
Do you mean the dropdown next to the green Goto icon? When VA shows 'namespace system', what happens if you press the down arrow? Does VA list your class as well? |
GregDude |
Posted - Nov 21 2012 : 4:49:48 PM quote: Next time it happens, can you please try what happens if you choose to proceed to this 'namespace System'? What file are you end up in?
'namespace System' appears in the Goto locations dropdown bar. Alt-G or clicking that label makes a sound and does not go anywhere.
I'll add more details later if I can learn anything new or see a pattern. I do recall this issue in the past when I had class names which were otherwise common symbols like 'Control' 'Window' and the like. |
accord |
Posted - Nov 21 2012 : 12:12:42 PM Ok, let's focus on the first issue, first. So you don't see this problem in all locations - this is a good start, it might be possible that something confuses VA in those locations where this issue happens.
First, is it possible that it happens with specific files or does the reproducibility also varies in the same file?
quote: ALT-G may not show your class, instead it shows 'namespace System'
Next time it happens, can you please try what happens if you choose to proceed to this 'namespace System'? What file are you end up in? |
GregDude |
Posted - Nov 20 2012 : 03:38:38 AM That test worked fine for me. Alt-G located the correct source.
I'm using native C++ only, VS2010 and VA1918.
I don't know what's different between this test and my code. My code is a reasonably large project (hundreds of source files, tens of projects.) Goto does work from some locations but not from others. It also sometimes locates a forward declaration instead of the implementation, but that's not specific to this issue. |
accord |
Posted - Nov 20 2012 : 03:08:40 AM We are working on a similar problem right now, so it might be possible that this problem will also be fixed in the next build.
For now, I will be trying to reproduce the problem using VA 1918. What Visual Studio and Visual Assist versions are you using? Are you using a native or managed project?
I have created a C++ Windows Forms Application project, using VS2010 and VA1918, and pasted the following into a newly created cpp file:
#include "stdafx.h"
#include "www.h"
using namespace System;
namespace My2
{
class AnyClass
{
void memberfunc2()
{
My::System::memberfunc1();
}
};
}
I also created a new header file with the following content, which I included to the cpp:
#pragma once
namespace My
{
class System
{
public:
static void memberfunc1()
{
}
};
}
Alt+g from System in the cpp file took me to the correct header file. Can you please try this test code on your side? If it work, do you have idea what you do differently in your "real" project? Thanks. |
|
|