Sublime Forum

F12 (goto symbol w/ C)

#1

For the longest time, I was able to press F12 when my cursor was on a C/C++ function call, and it would take me to the definition of that function as long as the file was in the project.

Recently, not sure which version, (or maybe I did something), F12 will now only search the files that are open (i’m using the same project).

Is there a setting I messed up? Or did this change along the way. I’m on 3069.

Also, is there a way to get ST to resolve C/C++ variables too? This has never worked. Only functions.

0 Likes

#2

On your main question, I don’t see that behaviour here so I’m assuming some plugin is getting in the way. Did you try a clean, portable install to reproduce the problem? If that fixes, try selectively disabling plugins until the problem goes away.

AFAIK Goto definition works with the tmLanguage to determine symbols. There’s an improved one for C/C++ here which may improve ST3’s goto definition behaviour with C/C++ sources.

:smile:

0 Likes

#3

thanks for the reply.
I used cImproved a while back. It does help a little. But even it says that it doesn’t even try to deal with c/c++ variables.

I get it, it’s not a trivial task and ST is not an IDE. So the variable thing is just a wish. :smile:

The thing about f12 not searching project files is annoying though. I installed 3065 portable and loaded the project. No plugins. No changes to the default preferences. Still same thing. f12 only searches open tabs, not all files in project.

Odd thing is, it does work for my cube neighbor. Obviously there is something with my system, but I’m not sure what yet.

0 Likes

#4

Yes, I checked and I see why. Sublime uses regex’s for all pattern matching; syntax colouring and symbol indexing. C-style variable declarations are very flexible and as a result would require lexical analysis to hone down; this would be nigh-impossible to implement as part of Sublime 3’s symbol indexing. Guess you’ll have to live without that.

To your problem with F12 only working with open tabs. This may have something to do with permissions; if you’re running on OSX or Linux try temporarily setting the permissions for your project’s source tree to 777, loading the project in Sublime and see if that improves things.

You could also hit Ctrl+’ or Ctrl+` to see Sublime’s log and see if it reports any errors during indexing.

Hope that helps :smile:

0 Likes

#5

Thanks, I’ll try looking at the log.
I’m running Win 7.

0 Likes

#6

I’m at a total loss. there must be something with my machine, but I can’t figure out what.

There are not indexing issues on the console.

So…

I have downloaded the portable version Win7 3065 and installed it totally clean.
I start St from the clean install
I drag a folder to ST to create a basic project.
F12 works
I load up my current working project and F12 does not work (only searches open files).
I remove all the folder_exclude_patterns and is now works.
I put back all the folder_exclude_patterns and it still works.

I go back to my main ST installation and F12 still doesn’t work. I have no key conflicts with F12.

I tried deleting the .workspace file and that doesn’t work.

F12 searches all files in projects with two co-workers and on a clean portable install on my machine.

Aside from removing all packages and re-installing one by one, is there anything else I can be looking for that might be the cause?

0 Likes

#7

Ahhh… here is another thing I just discovers
ctrl-shift-r
On my main installation, it will only show symbols within open files. As I open more files, more symbols appear-- and they disappear with I close the files.

On my clean install-- ctrl-shift-r shows symbols from all files in the project.

0 Likes

#8

Well, after some trial and error…I did find an issue in the console on project open:
error: unable to open crawldb (C:\DropBox\Apps\SublimeText3\Data\Index), indexing is unavailable

I deleted all files from …\Index and it is working again.

1 Like

#9

Hi @Mr-Homer, I’ve just registered here to say thank you.

This solutions worked like a charm! It’s worth noting that default Sublime Text 3 indexing directory is located here:
C:\Users\<user_name>\AppData\Local\Sublime Text 3\Index
Removing all files within this directory helped a lot - my ST is able again to jump here and there after pressing F12.

Once again - big THANK YOU!

0 Likes