rust-lang / rls

Repository for the Rust Language Server (aka RLS)
Other
3.51k stars 257 forks source link

rls autocompletion not working with web-sys (wasm) #1489

Open Barsonax opened 5 years ago

Barsonax commented 5 years ago

How to reproduce:

  1. First make sure you have vscode installed and rls working properly
  2. Clone https://github.com/rustwasm/wasm-bindgen.git
  3. Open the webgl example in vscode (https://github.com/rustwasm/wasm-bindgen/tree/master/examples/webgl)
  4. Build it (I tried both wasm-pack build and cargo build). It should build with no problems.
  5. Notice that there is no autocompletion available for everything in web-sys. Autocompletion does work for your own code and other crates.
delbato commented 5 years ago

I second this. I have no autocompletion whatsoever when using web-sys.

ljubisa-milivojevic commented 5 years ago
tiesselune commented 4 years ago

Same problem here, same example. Updated the WebGl example version to latests web_sys and js_sys, and updated my toolchains and RLS. Tried the method above, to no avail. I do get autocompletion for web_sys:: that suggests window and some info on web_sys::window if I hover it. But that's it. No trait or method gets completed for the rest of the code.

TheGreatB3 commented 4 years ago

It looks like the reason only web_sys::window shows up in autocomplete is that it's the only one in lib.rs. The rest of the definitions are in .webidl files, which get loaded in by build.rs at build time.

Because of that, I'd say the problem lies with the web-sys crate. The most relevant issue I could find is this one, but it doesn't seem very active.

Pauan commented 4 years ago

@TheGreatB3 It isn't web-sys's fault that RLS doesn't support build.rs scripts. A lot of Rust packages rely on build.rs scripts, it is a commonly used Rust feature.

However, this PR does remove the build.rs script from web-sys, so it will indirectly fix this.