Sublime Forum

Indexed symbols aren't in the autocomplete list!

#1

This seems like a no-brainer: you’re working on a large project with hundreds of symbol in its symbol index, you spend a lot of time typing those symbols, and of course because its a large project it is rare for a symbol to live in the same file you wish to use it. Yet autocomplete completely ignores the symbol index!

The suggestion is that this be a configurable option. An alternative is to leave this up to plugin writers, by giving access to the symbol index through an API, currently you can only retrieve the symbols in a specific open view (even though the symbol index includes all files, open or not, which is exactly what we need).

1 Like

Autocomplete from Symbols in Project list
Autocompletion of "phrases" (allowed to contain whitespace characters) without manually adding sublime-completion entries - possible?
Syntax Scopes Q: `meta.path` and `meta.generic`
#2

An API function to query all symbols of the index by selector would really be cool.

symbols = view.indexed_symbols("source.python entity.name.function")
3 Likes

#3

+1 to the API function. But to the OP’s point, I actually prefer that the symbol autocomplete is limited to just the current view. It would be really really overcrowded if every indexed symbol were in the autocomplete. Also, it wouldn’t actually get you what you want, since many symbols are simply not indexed! Nearly all language definitions (by design) fail to index variables, for example, or functions that are not strictly public.

At the end of the day, Sublime is not an IDE. There are several plugins which provide this kind of semantic indexing functionality within Sublime (e.g. ENSIME for Scala), and they might serve you better than the vanilla editor.

4 Likes

#4

There are several plugins which provide this kind of semantic indexing

Agree. Something like that can’t and shouldn’t be provided by the editor.

The use case I had for the API function, was to provide auto-completion of indexed functions/cycles/global vars for my CNC SINUMERIK 840D package, which no language-server or any code intelligence tool exists for at all. A user was asking for such a feature recently, but the only way I found to accomplish so far was to create my own index using watchdog library. That’s no fun.

1 Like