Sublime Forum

"Show Definition" feature not working correctly (on mouse hover of commands)

#1

Since version 3124, ST3 shows the definitions/references to my commands when I hover my mouse over the command. Unfortunately. its not working correctly. Hovering my mouse over to PowerShell commands will point me to android-related Python code…

Why does it think that my powershell commands are included in arbitrary python code? I don’t mind using this feature, but only if it’s referencing other PowerShell code.

Any help with this would greatly be appreaciated!

0 Likes

#2

Definitions and references are powered by the symbol list, which comes from every file that’s currently being indexed in the current project as well as any files that happen to be open.

You can use View Package File from the command palette to open Default/symbol.py and see the implementation of this. In particular, lookup_symbol() and lookup_references() perform the symbol lookups and the on_hover event handler in the ShowDefinitions event listener is responsible for displaying the popup.

From looking at the implementation you can see that it combines symbols from the symbol index as well as the list of open files, but it doesn’t try to filter those based on the language or type of file that’s currently being used.

As such I’m not aware of any default way to get it to constrain the results based on the source languages, but the code here could be modified via an override or replaced wholesale with something that has that sort of logic in it.

If I had to guess I would say that it works this way due to a combination of most projects would only contain the same sorts of files, and that if they don’t the symbols may be related anyway (for example if you were writing native code to combine with Java code).

0 Likes