Sublime Forum

Goto symbols in project implementation

#1

Hallo,
can anyone tell me if and where I can find the implementation of the “Goto Symbol In Project”-Command?
I was able to get all indexed symbols of the current view. I need the indexed symbols of all files in the project. I don’t want to open all files and then iterate over the views to get all symbols. I hoped to find the answer in the GotoSymbolInProject-Command, but I only found the implementation of the GotoDefinition-Command.
Thank you for any help, Sebastian

0 Likes

#2

I was also interrested in something similar but it seems to be not possible …
I was surprised to see two function for symbols (view.symbols() and view.indexed_symbols()) that looks like they retrun the same thing. Maybe indexed_symbols is just not working as intended.
API around the index symbol really need to be enhance: sublime is doing a good job a getting information from all files in the project, but the way to use it from a plugin is very limited :-/ I would also love to have slightly more information in the index like the scope of the symbol.

I had a similar issue to get access to the list of files in the project: existing in sublime but not available to the plugin .

0 Likes

#3

I was able to get the list of files in a project via Window.get_project_data(). I tried to access the symbol-index by initially creating views for all files in the project: Window.open_file() and then get all symbols of a view via View.symbols(). Unfortunately you can access the symbols only when the view is actually openened, open_file(somePath, sublime.TRANSIENT) doesn’t work.
Thank you for the answer. Now I know that I can search for another solution. It is really a pity because validating and caching symbols after key-events is really painful and sublime seems to have a super-performant solution for that.

0 Likes

#4

I wanted to write a symbol plugin that would add all symbols in the symbol registry to the autocomplete list (totally bizarre and frustrating that autocomplete doesn’t autocomplete the current projects freaking symbols, how is that not totally obvious – do you type your own symbols much?). But no, it’s impossible! Of course, the data is there just waiting there, it’s just locked away behind an unhackable C++ interface.

0 Likes