-
Notifications
You must be signed in to change notification settings - Fork 3
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
Decide on language server binary distribution #3
Comments
Updates on option 1 below. This is mostly me describing the most promising paths I took so I can try it again in the future when the ecosystem is more mature; to see the conclusion, skip to the next section. What I triedAfter attempting multiple ways to compile to WASM with tree-sitter support described in this thread, this amazing blog post, and this comment, we got the project compiling successfully to WebAssembly by disabling tokio's
Unfortunately, this isn't enough with how the project currently works. We use the #[tokio::main(flavor = "current_thread")]
async fn main() {
let stdin = tokio::io::stdin();
let stdout = tokio::io::stdout();
let (service, socket) = LspService::new(Backend::new);
Server::new(stdin, stdout, socket).serve(service).await;
} As tracked in tokio-rs/tokio#6516, the library does not currently have support for stdin/stdout in WASI, even though its standard allows it. One option to deal with this would be to have the server receive messages through TCP sockets, although I'm unsure on how to connect those to VSCode. I've tried poking around tokio to get [unstable]
build-std = ['std', 'panic_abort', 'core', 'alloc']
[build]
target = "wasm32-wasip1-threads"
rustflags = '-C target-feature=+atomics,+bulk-memory,+mutable-globals,-crt-static' and ran the following command:
It fails during linking with the following error message:
This should have been fixed by the Current attemptNot all hope is lost. We could switch from using This will be my last attempt on the proposed solution 1, if it doesn't work, we will be trying solution 2. |
I followed the blog post from the VSCode team to try to reproduce their build, but unfortunately, that lead us to two problems:
This is possibly a fixable error, but the real problem is below.
That's because Unfortunately, the WASM/WASI technology is still not good and reliable enough for us to work with proposed solution 1. Maybe one day... For now, we'll work with solution 2. |
Just to be clear, if tokio-rs/tokio#6516 was solved, we would probably be able to go with solution 1. |
UpdateAs explained above by edusporto,
Regarding the Visual Studio Code extension, the plan is to release an MVP focusing on Debian-based and Darwin-based (MacOS) operating systems. full support for windows will be added at later dates as we refine the cross-platform functionality. |
Finished implementing solution 2 on commit 0f4a173. |
The language server (LS) for Bend is currently written in Rust using the relevant libraries
tower-lsp
,tokio
, andtree-sitter
. We have now reached a stage we would like to publish the language server as an extension to VSCode, but this raises a technical challenge - how are we going to distribute the language server binary to users of the extension?We have thought of four solutions, ranked by how desirable they would be to the team.
tokio
, which we currently use and could change, does have support for WASM, but it is a bit bare-bones and is missing a lot of features. The real problem though istree-sitter
, which is currently fundamental to our syntax highlighting and diagnostic reporting, and is not easy to compile into WASM.cargo install bend-language-server
I am currently trying to get option 1 working.
The text was updated successfully, but these errors were encountered: