Skip to content
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

Feature request: support additional language servers #336

Open
rictic opened this issue Mar 13, 2018 · 6 comments
Open

Feature request: support additional language servers #336

rictic opened this issue Mar 13, 2018 · 6 comments

Comments

@rictic
Copy link

rictic commented Mar 13, 2018

VSCode/Monaco supports extension through the Language Server Protocol.

It would be really awesome to be able to enhance the editing experience for a project or an embed by adding additional language servers. For example, the Polymer team maintains a language server that provides enhanced linting and autocompletion for custom elements, HTML templates, and some Polymer-specific features. It probably doesn't make sense to run this server for all users, but it would be really great to be able to run it.

The natural way to run a language server in the browser is in its own web worker. The API could be as simple as the user specifying a set of urls of their web workers' sources. The worker/host could then communicate entirely with the language server protocol over postMessage.

@JosefJezek
Copy link

JosefJezek commented Mar 20, 2018

@EricSimons
Copy link
Member

@rictic @JosefJezek I love this idea. We actually just implemented the Angular language service on stackblitz; we'd love to also have support for all the other ones out there. Would either of you be able help create a proof of concept for this? Our eng timeline is completely packed for the next 2-3 months, so external help sorting out the implementation details/challenges would be 💯

@JosefJezek
Copy link

@rictic
Copy link
Author

rictic commented Mar 25, 2018

@EricSimons I'd be interested, what would you be looking for out of a proof of concept?

Here's a Monaco editor running the Polymer team's language server via an in-browser web worker.

The integration is a little sloppy there, when I set that up monaco-languageclient seemed pretty limited so I use a simple wrapper to translate the LS protocol to something that's closer to the monaco API. It seems like stackblitz might be using more of vscode than just monaco though? I poked around a bit but I couldn't find the source for the editor anywhere.

If you've got other language services working it seems like the major design considerations are taken care of (e.g. URL scheme, document model, persistence, etc).

A few questions for ya'll: Do you run the language servers on the client or the server? What were the sorts of issues you needed to resolve and modifications you needed to make for the typescript and angular language servers?

@rictic
Copy link
Author

rictic commented Apr 2, 2018

Summary from chatting on discord:

  • currently StackBlitz just integrates TypeScript (and Angular + TypeScript), which might be using a pre-LSP protocol to communicate from editor to server.
  • a useful next step would be a demo of monaco handling multiple configurable LSP servers running in web workers, using something like https://github.com/TypeFox/monaco-languageclient

I'll poke around at that, probably this weekend!

@akosyakov
Copy link

@rictic Can you run arbitrary language servers in web workers? Language servers assume that they have access to the filesystem and can run local tools. APIs available to web workers are very limited, mostly they can do async requests as far as i know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants