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

Bindings' long unformatted lines does not work well with RLS #1457

Closed
LaylBongers opened this issue Apr 14, 2019 · 4 comments · Fixed by #1461
Closed

Bindings' long unformatted lines does not work well with RLS #1457

LaylBongers opened this issue Apr 14, 2019 · 4 comments · Fixed by #1461
Labels

Comments

@LaylBongers
Copy link

Describe the Bug

RLS (and by extension vscode-rust) doesn't like really long lines. It expects the code to be formatted reasonably. This as a result causes some issues. Errors are shown about RLS not being able to tokenize long lines for performance reasons, and tooltips show the entire line, slowing down VSCode in the process:

Code_2019-04-14_19-59-57

Expected Behavior

It would be nice if these bindings were run through rustfmt, or just formatted a bit more friendly to RLS.

@alexcrichton
Copy link
Contributor

Heh this is quite the interesting issue!

We actually already have support for formatting the generated binding by setting the WEBIDL_RUSTFMT_BINDING=1 env var, but we turned it off by default at the time it was added because the bindings were so large and executing rustfmt took far too long.

Nowadays though with web-sys being much slimmer by default, I suspect we could flip the defaults! Could you try building with that env var locally and see if it improves the IDE experience?

@Pauan
Copy link
Contributor

Pauan commented Apr 15, 2019

@alexcrichton Also, we should change the docs so they properly format things.

I often try to use the [src] link to see how a particular type/method is implemented, but right now it's completely useless.

alexcrichton added a commit to alexcrichton/wasm-bindgen that referenced this issue Apr 15, 2019
This commit switches to executing `rustfmt` by default on
`web-sys`-generated bindings. This improves situations like "view
source" in Rustdoc as well as the IDE interactive debugging experience.

This was initially disabled by default because `rustfmt` took so long to
execute, but nowadays `web-sys` is by default much smaller so there's
much less need to avoid running `rustfmt` in fear of it taking too
long.

Closes rustwasm#1457
@Pauan
Copy link
Contributor

Pauan commented Aug 2, 2019

I'm not sure when this regressed, but it seems that the web-sys docs are not being formatted, so they appear as a huge blob of unreadable code.

@alexcrichton
Copy link
Contributor

This only works if rustfmt installed, so perhaps docs.rs was updated to not have rustfmt installed?

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

Successfully merging a pull request may close this issue.

3 participants