Reputation: 700
I would like to support basic code navigation in my extension for my custom script langauge. Things are not too complicated, a simple regex can actually find where a call or jump occurs and where it goes. VSCode API says: (https://code.visualstudio.com/api/references/vscode-api)
Despite that, features like automatic word-completion, code navigation, or code checking have become popular across different tools for different programming languages.
So I think it should be possible, but I can't find any API for that. I don't yet want to implement a full-blown external language server, but the simpler in-built typescript.
I might misuse the term "code navigation", so under that I mean that if I ctrl+click a variable or function name I can navigate where it is declared.
Is there any API for that?
Upvotes: 3
Views: 982
Reputation: 34138
Sounds like you're looking for vscode.languages.registerDefinitionProvider()
.
The definition provider interface defines the contract between extensions and the go to definition and peek definition features.
Relevant section of the docs here.
Upvotes: 4