1

I am writing a VS Code extension that will use functionality provided by a language server.

Am I required to bundle the language server into my extension?

Is there any way to use language servers already installed in my user's VS Code environment? For example, if my users have the Pyright extension installed, could I connect to it somehow?

1 Answer 1

4

Generally speaking no, you can't use the language server from other extension, because each extension runs isolated from each other, so it wouldn't be available to you.

But there are some ways, as extensions can expose their own API, and your extension could rely on it. It would be a matter of the API exposes what you need from their language server. Or, depending on what you need from their language server, you could use VS Code APIs. For instance, if you would like to know the symbols (methods, classes, etc) from a file, you could call commands.executeCommand('vscode.executeDocumentSymbolProvider',....

Otherwise yes, you should bundle the language server on your extension.

Hope this helps

Sign up to request clarification or add additional context in comments.

1 Comment

And for future reference: The way that extension writers provide APIs to other extensions is by returning their API public surface from the activate-call.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.