Sublime Forum

[ST3] "Go to Definition" does not respect language

#1

Hi,

I’m using the latest beta of ST3 (3021) and I found an pretty annoying problem with the “Go to definition” feature.

Consider you have a project with both C++ and HTML/JS files and in one C++ header you have a method called “equal” (and defined in the appropriate implementation file) and in a JS file you have also a method called “equal”.

Now navigate to a C++ file where “equal” is used and trigger “Go to definition”, it will show a list of symbols for “equal” containing the JS definition and the C++ definition. One could say that when I trigger the “Go to Definition” from the C++ file, the JS symbol should not even show up but the worst part is that the order in the list is depending the naming of the directory the file is in. For example the JS symbol will always be the first if the directory where the JS file is “A” and the C++ header is in “B”. Changing the order of the directories makes the C++ symbol showing first. I didn’t find a way to setup correctly what I want : C++ code -> C++ symbols, JS/HTML code -> JS/HTML symbols.

One could say I should not mix the type of files in my workspace but it is very common that testing files are in a different language that the program itself. It is frustrating that when I want to navigate in my C++ code with “Go to Definition” I get polluted by JS symbols which obviously are not a match for the symbol my cursor is at. I believe that when Indexing the workspace ST should mark the type of the file and when triggering “Go To Definition” it should propose alternative for the same type of files.

Thanks.

0 Likes

#2

I have the same problem, but it’s usually with PHP and Javascript files in my case. Also, goto definition can return many extra results if the project has a lot of classes which have the same method names. It would be nice if it knew what kind of class the selected object is an instance of.

0 Likes

#3

I also have the same problem. Please fix it else it is forcing people to go back to eclipse. It would be awesome to get jump to definition work correctly.

0 Likes