code-gnu-global icon indicating copy to clipboard operation
code-gnu-global copied to clipboard

Go to Definition for functions declared outside the project folder

Open rei-vilo opened this issue 9 years ago • 4 comments

I'm using the procedure described to add folders and index files external to the project folder as per 2.3 Applied usage in the GNU GLOBAL Source Code Tag System tutorial.

$ cd project/folder
$ (cd /external/path1; gtags) 
$ (cd /external/path2; gtags) 
$ export GTAGSLIBPATH=/external/path1:/external/path2

Let's consider function_in_path1() declared in file /external/path1/functions1.cpp with the corresponding header. The main.cpp includes /external/path1/functions1.h and calls function_in_path1().

When pointing on function_in_path1() and calling the contextual menu, the options Go to Definition, 'Peek DefinitionandFind All Referencesare displayed but none of them actually works. However,global function_in_path1` returns the right path and file.

$ cd project/folder $ global function_in_path1 ../../../../external/path1/functions1.cpp

Thank you!

rei-vilo avatar Jan 21 '16 18:01 rei-vilo

Did you run code from the same shell after GTAGSLIBPATH is exported?

austin----- avatar Jan 21 '16 22:01 austin-----

Good point!

I launched VSC as a standard app on my Mac, but I created the indexes with gtags and set the GTAGSLIBPATH variable on a Terminal window.

So the question might be now, how to set the GTAGSLIBPATH variable within VSC.

rei-vilo avatar Jan 22 '16 09:01 rei-vilo

As a workaround, refer to https://code.visualstudio.com/Docs/editor/setup on how to setup vscode to launch from command line on OS X.

I will probably add an extension setting to set this env variable within vscode.

austin----- avatar Jan 23 '16 02:01 austin-----

Thank you for the pointer!

rei-vilo avatar Jan 23 '16 09:01 rei-vilo