Sublime Forum

Goto Definition only possible for open files?

#1

Hello,

I love the goto_definition command, but it’s only working for files that are open (visible in tab view) for me. Is it possible to extend the index of goto_definition to all project files or < open files >?

Cheers,
Mershl

0 Likes

#2

it should work for all open files and all project files (whether open or closed) by default.
Are you perhaps using a package/language syntax that doesn’t add it’s definitions to the project index? Go to definition anywhere in the project not working

1 Like

#3

Thank you for your quick answer. This could be the problem. I’m using the ‘C Improved’ package which adds a new language syntax. I’ll need to check how to add the definitions found by C Improved to the index used by goto_defintion.

0 Likes

#4

yeah, it looks like C Improved doesn’t add it’s definitions to the index: https://github.com/abusalimov/SublimeCImproved/blob/d9782343be09cf34da6a5fbb3238fcab588a9bc0/settings/Symbol%20Index%20(function%20declaration).tmPreferences#L9-L10

the readme even makes a mention of it:

0 Likes

#5

I’ve clean up most of my Sublime settings now to keep it to a minimum. Changing the option for C functions inside C Improved .tmsettings didn’t fill the index after restarting Sublime.

0 Likes

#6

Have you tried the C syntax shipped with ST3 recently? We did significant work on it this year, and it indexes all functions, structs, typedefs, etc.

0 Likes

#7

I had this issue before. I can tell you that go to definition works across project, not just opened file.

You are having a mis config in your sublime. My solution is, backup your sublime preferences. Then remove sublime and it’s preferences complete from your computer. Re-install sublime and the packages, then try to see if jump to definition work as it should.

0 Likes