Sublime Forum

Goto definition doesn't work for .js with AMD plugin structure

#1

Hi,

I have some problems with the goto definition functionality and javscript with AMD (https://de.wikipedia.org/wiki/Asynchronous_module_definition).

I can’t go to any of the methods defined in our plugins. Sublime just prints “Unable to find […]”. Methods in other js-files are found by the goto definition functionality.

Other editors like Visual Studio Code are able to find the method declarations in our plugins but I would prefere to use Sublime 3.

Has anyone a solution for this problem?

0 Likes

#2

Methods and functions are identified by the *.sublime-syntax file. All files scoped as entity.name.function are added to the index and provided as target for the Goto Definition functionality. All of this happens based on regex patterns applied to the source.

With a short look into what AMD is I find it hardly possible to scope all AMD methods well using ST’s builtin functions. This technology basically means creating functions dynamically and assigning them to a variable.

Doing so requires a kind of lexer which is able to interpret those language constructs.

Did you try SublimeCodeIntel or LSP with a javascript/typescript language server?

0 Likes

#3

Thank you for your answer. The CodeIntel works fine.

0 Likes