2
votes

On VSCode you can register to provide an specific function of a language server like:

vscode.languages.registerDefinitionProvider
vscode.languages.registerCompletionItemProvider

Is there a way from the extension get the list of all the providers and call it's methods to for example get completion items for a given position on the editor?

Thanks

1

1 Answers

1
votes

Yes, these can be called via various vscode.execute* commands, for instance vscode.executeCompletionItemProvider. See the official docs on Built-in Commands for a full list.

As for getting a list of all providers, that seems trickier. You could just try calling a provider and see if you get any results. There's getLanguages(), but that doesn't tell you what providers are registered for a particular language, only that the language itself is registered.