Skip to content

Allow extensions to provide language servers for the use of other extensions via LanguageClient. Provide native language servers by default. #56873

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jacob-church opened this issue Aug 21, 2018 · 5 comments
Assignees
Labels
*dev-question VS Code Extension Development Question

Comments

@jacob-church
Copy link

The extension development utilities in VS Code are great, but may require extension authors to build up their own language server from scratch. At least in regards to generic information about one's code base such as definitions, references, and nav trees, it would be much easier if an extension author could talk to a language server provided by another extension or native to VS Code itself (e.g. Typescript).

Here's how it could work:

  • When an extension author creates their own language server (implementing the LSP), they "provide" that server to VS Code in the form of a LanguageClient.
  • Another extension author can check the provided LanguageClient's within VS Code, and if the desired client exists (either natively or thanks to another extension they've installed), inject it into their extension and begin making requests. (If it is not provided, they could initialize their own LanguageClient in the usual way.)

In order for this to really be useful first and foremost the native language servers in VS Code would need to be available. Then contributors could create extensions that exclusively provide a language client and server. Then extensions that wish to leverage these language servers can focus on their own extension specific functionality.

I think this would change the approach to language tooling a bit, but ultimately for the better. Right now my own team is developing an extension that needs definition and reference info for Typescript and there doesn't seem to be any way to piggy back off of the native Typescript server. As a result we spin up another Typescript server within our extension. This feels unnecessary and computationally wasteful (not to mention cumbersome).

@vscodebot vscodebot bot added the extensions Issues concerning extensions label Aug 21, 2018
@octref
Copy link
Contributor

octref commented Aug 21, 2018

Related: #1751 (comment).

and if the desired client exists (either natively or thanks to another extension they've installed), inject it into their extension and begin making requests.

It's possible, just not documented, see #47288.

However, it seems what you want is TS Server Plugin.

I'll close this because there is nothing actionable or not captured in other issues , but feel free to continue the conversation or bring up more questions.

@octref octref closed this as completed Aug 21, 2018
@octref octref added *dev-question VS Code Extension Development Question and removed extensions Issues concerning extensions labels Aug 21, 2018
@jacob-church
Copy link
Author

@octref So, to be clear, I can create a plugin for the typescript server which would allow me to essentially create a typescript server proxy in my extension so I can directly make defintion, reference, etc, commands to the native Typescript server?

The key piece is that I need to be able to make deliberate requests to the typescript server from my extension

@octref
Copy link
Contributor

octref commented Aug 21, 2018

So, to be clear, I can create a plugin for the typescript server which would allow me to essentially create a typescript server proxy in my extension so I can directly make defintion, reference, etc, commands to the native Typescript server?

Yes.

The key piece is that I need to be able to make deliberate requests to the typescript server from my extension

You can create TS files in VS Code and use these API: https://code.visualstudio.com/docs/extensionAPI/vscode-api-commands to get results of, say, a Hover request.

@jacob-church
Copy link
Author

...wow. I know I looked at that page and I just didn't see it. I think I assumed that those commands wouldn't work because I hadn't created the providers myself. Thank you!

@octref
Copy link
Contributor

octref commented Aug 21, 2018

Yeah, our extensibility doc could use better structures...

@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*dev-question VS Code Extension Development Question
Projects
None yet
Development

No branches or pull requests

2 participants