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

Add rust-analyzer-wasm #813

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add rust-analyzer-wasm #813

wants to merge 1 commit into from

Conversation

HKalbasi
Copy link
Member

closes #357

How to run

  1. Download the pkg.zip
    and extract it to ui/frontend/intellisence/pkg. (This is output of wasm-bindgen from my fork of rust-analyzer-wasm repo, you can also build it from source but downloading it will save you some time and trouble)
  2. Run yarn watch (or anything that makes ui/frontend/build directory)
  3. Install syn-file-expand-cli with cargo. This is used for packing standard library to a single file for ra.
  4. Run bash generate-crate-src.sh inside ui/frontend. This will actually pack standard library.
  5. Make a symlink from ui/frontend/build/assets/assets to ui/frontend/build/assets. This is because ra-wasm tries to get somethings like /assets/assets/foo and even /assets/assets/assets/bar, and I don't know how to fix it.
  6. Serve build directory with sfz --coi. You can install sfz via cargo or use your static server of choice, but send coop and coep headers in order to make wasm threads working.
  7. Now it should work

These steps should also be done for production, but I don't know what is the best way for it.

Things that might be wrong/you may don't like

  • This is off by default, but there is a big button to enable it, in order to make it discoverable for new users. It might be considered too noisy.
  • The config of rust-analyzer is in a separate dialog, because those options can grow and become too much for original config menu (currently they are not that much) and changing them require reload. With this dialog, user can change multiple options and have a reload at the end.
  • We will keep the downloaded version of standard library and won't sync it with compiler versions, to save bandwidth (standard library is bigger than ra-wasm). User can change in setting.
  • The current binary is from a fairly ancient rust-analyzer, and there is no plan to update it, but updates are possible with some manual work. If we want to bump r-a version frequently, we should probably make updates optional (like the updates of standard library) to save bandwidth.

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

Successfully merging this pull request may close these issues.

Compile Rust Language Server into WASM to provide IntelliSense and completions
1 participant