code-gnu-global
code-gnu-global copied to clipboard
find all references for class member variables returns empty results
seems like a limitation of using gnu global for "C++ Indexing". this is one of my most used features with eclipse/cdt, it saves a ton of time when you need to do a lot of reverse engineering for a large code base.
$ global --version global (GNU GLOBAL) 6.5.6
Same here, but after try several configurations now works if:
- Set the codepage in your user setting, ex: "codegnuglobal.encoding": "windows1252"
- Add global to PATH, is not working if I only use the setting "codegnuglobal.executable", it has to be in the PATH envvar.
This way it work, in my configuration: VS Code 1.15.1 with Windows 7 Pro. C++ Intellisense 0.2.2 Global 6.5.6
I hope it helps you.
I also have same problem. I can only find the references for function. But when find references for class member variables and local variables, tool returns empty results. but I can find those var in GRTAGS with tool gtags --dump
my configuration: VS Code 1.15.1 with Mac Sierra 10.12.6. C++ Intellisense 0.2.2 Global 6.5.6
global --version global (GNU GLOBAL) 6.5.7
Hi vihist, You're right, I have the same problem when find references for variables (member or local) :-(
so when the issue can be solved? This feature is very useful. Thanks
I think has more information about the issue:
- The command that the extension executes is the same command for functions and for variables
global --encode-path " " -rax <symbol>- The switch "-r" in the command means that global searches through symbols defined in GTAGS file.
But the variables are not defined in GTAGS file, is a future plan for global:
https://www.gnu.org/software/global/plans.html
The following command works for variables but not for functions:
global -sax <variable>
The switch "-s" in the command means to locate symbols which are not defined in 'GTAGS'.
But if the both switches are written works for functions and variables!
global -srax <function>
global -srax <variable>
So the solutions for the extension to work with both, as I see is:
- Execute different global commands for functions and variables: Difficult for the extension to know what is selected.
- Modify the command and add the "-s" switch.
- Wait to global plan for add variables to GTAGS file
I made the 2nd solution that is quite simple:
- Open file "C:\Users\XXXX.vscode\extensions\austin.code-gnu-global-0.2.2\out\src\referenceProvider.js"
- Replace the line:
return this._global.run(['--encode-path', '" "', '-rax', word])withreturn this._global.run(['--encode-path', '" "', '-srax', word]) - Restart VSCode.
Hope that helps.
The problem is solved. Thanks a lot!
But there still some problems, for example:
void DisPlay1()
{
int aTest = 0;
std::cout << "git Learn!\n" << aTest;
}
void DisPlay2()
{
int aTest = 0;
std::cout << "git Learn!\n" << aTest;
}
when I use find all references for var aTest in function DisPlay2, result return with the references of aTest in function DisPlay2 and DisPlay1
True, same with function, ex:
class CAA
{
int Init() { return 0; }
};
class CBB
{
int Init() { return 0; }
};
void DisPlay1()
{
int aTest = 0;
CAA aa;
aa.Init();
std::cout << "git Learn!\n" << aTest;
}
void DisPlay2()
{
int aTest = 0;
CBB bb;
bb.Init();
std::cout << "git Learn!\n" << aTest;
}
Finding references for Init() in CAA class, it executes the command:
global --encode-path " " -srax Init
giving references for Init() of CBB class too. Finding references for CAA::Init nothing is shown.
I think that this is more "global" problem that the extension's. I don't know how to solved or workaround this one.