Open TiemenSch opened 1 year ago
I'm currently trying this out with a custom language server I'm building with a similar setup and think I'm well underway to figuring it out. Will report back today or tomorrow!
So I have a proof-of-concept working in my own extension's repo. I'm by no means an esbuild/bundling/extension expert, so I would love to hear any good suggestions/improvements on that front. It works for both the node and browser entrypoint. Some caveats, though:
path:node
and friends, but might be the culprit. Or the worker should be cached somewhere and properly .terminate()
d on client stop../out
tree.Any constructive suggestions are highly appreciated :) https://gitlab.com/ratio-case-os/rust/esl-compiler/-/tree/main/vsx
Sorry for asking this here, but do you know why their server doesn't use another process instead of js binding?
There are many different ways to run a language server and connect to it with a client such as VS Code, but this issue goes about rather making it "more JS like" such that it also works fluently in the browser version of VS Code. (like https://vscode.dev). On such web targets, spinning up a process isn't the same thing as on a local desktop environment.
With VS Code being an electron application, it makes sense to keep things in JS land for both desktop and web.
I'm exploring the route of compiling to Rust code to a WASM file and using that on every platform with preferably minimal JS code to glue things together. When properly setup, that should keep the setup simpler.
Since the VS Code extension already uses WASM compilation of the Rust language server, I believe it should be possible to add a browser entrypoint to the extension. That would mean that users could use it on https://vscode.dev or similar web-based environments.
Their migration instructions are listed here: https://code.visualstudio.com/api/extension-guides/web-extensions#migrate-extension-with-code