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

WASM demo #1007

Closed
matklad opened this issue Mar 20, 2019 · 7 comments
Closed

WASM demo #1007

matklad opened this issue Mar 20, 2019 · 7 comments
Labels
E-hard fun A technically challenging issue with high impact good first issue

Comments

@matklad
Copy link
Member

matklad commented Mar 20, 2019

It would be super cool to have a web-page which demoes rust-analyzer by running it with WASM. This could be a prototype of a WASM-powered rust-playground, which, for example, does syntax checking on the fly.

The MVP would probably be to compile ra to WASM and create a github page, with a text-area where you can edit rust code, and another text area where you see the syntax tree.

To make it really cool, we need to add Monaco editor with rust-analyzer powered syntax highlighting and simple completions support.

@matklad matklad added good first issue E-hard fun A technically challenging issue with high impact labels Mar 20, 2019
@georgio
Copy link

georgio commented Mar 20, 2019

I could give that a shot and let you know if I come up with anything! Super cool idea 😁

@matklad
Copy link
Member Author

matklad commented Mar 21, 2019

Recently introdced Analysis::from_single_file would be of help here:

3eb56f7

@matklad
Copy link
Member Author

matklad commented Mar 22, 2019

For syntax highlighting, see https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.itextmodel.html#deltadecorations. We should not used the approximate monarch infra for this.

bors bot added a commit that referenced this issue Mar 22, 2019
1021: Wasm dependencies r=matklad a=detrumi

As a first step towards running RA on WASM (see #1007), this tweaks the dependencies somewhat so that projects built using `wasm-pack` can use `ra_ide_api` as a dependency.

There were two problems:
- use of undeclared type or module `MmapInner`
This error occurred because of the `memmap` crate, as a dependency of `fst`
Solution: specify `default-features = false` for the `fst` package (see BurntSushi/fst#70)

- use of undeclared type or module `imp`
This happened in the `wait-timeout` crate ([which uses `Command` under the hood](alexcrichton/wait-timeout#18)), a dependency of `rusty-fork` which is a dependency of `proptest`.
Solution: move `proptest` to dev-dependencies and add `#[cfg(test)]` to the `test_utils` crate.
**Edit:** Oh, that causes trouble with resolving the import when running the tests. Hmm...

Co-authored-by: Wilco Kusee <[email protected]>
@detrumi
Copy link
Member

detrumi commented Mar 23, 2019

There's still an issue with the proptest dependency, I've opened proptest#137 and have a workaround branch here that can be used to patch proptest, using which I successfully built ra_ide_api using wasm-pack 🎉

@matklad
Copy link
Member Author

matklad commented Mar 23, 2019

I guess, just patching proptest in root Cargo.toml using [patch] to a git repo :)

EDIT: ... would work

@Lapz
Copy link
Contributor

Lapz commented May 6, 2019

@JasperDeSutter JasperDeSutter mentioned this issue Sep 1, 2019
12 tasks
@matklad
Copy link
Member Author

matklad commented Sep 20, 2019

We have wasm demo here now: https://github.com/rust-analyzer/rust-analyzer.github.io!

I bet it can be greatly improved, but I don't have capacity to drive the improvements. If you have desire to tinker with WASM, feel free to hack on it how you see fit!

@matklad matklad closed this as completed Sep 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-hard fun A technically challenging issue with high impact good first issue
Projects
None yet
Development

No branches or pull requests

4 participants