Closed tamasfe closed 2 years ago
The big question is how to port Rhai LSP to browsers. There are several options:
Is this necessary? I would have thought a WASM runtime is already flexible enough...
The big question is how to port Rhai LSP to browsers. There are several options:
I would have thought a WASM runtime is already flexible enough...
It is not, as I mentioned, there is no i/o, threading, both of which should be handled when targeting WASM.
Ah, ok... now I understand. However, I'd say that it would be a huge feat if you can make WASM work. An LSP in WASM would avoid the need to pre-package a lot of pre-built binaries for different OSs.
If we don't find better alternatives, I think we can do the same thing I did with taplo. Which means defining "external" functions that cannot simply be done in WASM (such as i/o), and then just use wasm-bindgen and a javascript shim over them, and also switch the runtime from tokio to the one available in javascript (as there is no threading, and no async in WASM either).
switch the runtime from tokio to the one available in javascript
Is multi-threading a necessity in an LSP? I don't know much about one so I can't guess.
Not sure if this would be useful: https://www.osohq.com/post/building-vs-code-extension-with-rust-wasm-typescript
Is multi-threading a necessity in an LSP? I don't know much about one so I can't guess.
It's not necessarily, it's not even possible in WASM (out of the box), but it obviously helps with performance.
Not sure if this would be useful: https://www.osohq.com/post/building-vs-code-extension-with-rust-wasm-typescript
Thanks, it looks like the same approach I outlined.
This was merged in #79.
I started with targeting WASM initially as it can be run in the browsers, and the VSCode extension distribution is trivial.
However there are a few issues:
So right now I left the WASM builds as-is, and switched to a native executable for the initial development. I will also clean up any unnecessary WASM-related build steps and javascript shims to make contributions easier.
The big question is how to port Rhai LSP to browsers. There are several options: