Although this may seem like a duplicate, I believe it's slightly different than other issues.
Main issue is that Intellisense works for external crate's very top module but not anything within its submodules. Meanwhile hovering & documentation pop-ups work for everything!!!
I believe this is related to the fact that the dependency has optional features.
In the minimal example provided in this repo, you can see that external crate has a feature that needs to be enabled for unix platforms: socket2 = { version = "*", features = ["unix"] }
It seems that auto-completion for top-level modules/structs is working:

but the inner impl or methods fails to appear in completion list:

What makes it more interesting is that
impl or methods actually work & shows their full definition and documentation, hinting that rls/racer is aware of them but for some reason can't show them in auto-completion:

I have encountered similar issues in my other projects where either external crates or my own crate has some optional features that seems to confuse rls/racer.
The above test is on a fresh installation of vscode that only has Rust extension installed with following noteworthy settings:
{
"rust-client.channel": "stable",
"rust.all_features": false,
"rust.racer_completion": true,
"rust.all_targets": true,
"rust.features": [],
}
(I tried to play with some of those settings but didn't help!)
I am using
rls 1.36.0 (9692ca8 2019-05-18)
rustup 1.18.3 (435397f48 2019-05-22)
cargo 1.36.0 (c4fcfb725 2019-05-15)
(on x86_64 GNU/Linux)
Please let me know if more info is needed.
Is the rls-vscode team able to repro this issue? This bug makes the extension unbeneficial for anyone trying to use Rust WASM, as the web-sys crate containing all the DOM bindings relies extensively on features.
I'm also having troubles, and the web-sys crate is particularly difficult to use without intellisense. I'm creating a tutorial video on 3D graphics in the browser, and it's quite embarrassing to not have intellisense working properly. I have to know precisely what I'm typing, which is very difficult for some of the longer names.
I would appreciate any hints as to how I can make this work correctly as the current situation really diminishes the value of Rust altogether.
I'm having the same problem. Is there any update on this?
Still no news/reaction? :(
My understanding is that the bug (likely multiple bugs) is either in RLS (https://github.com/rust-lang/rls) or in Racer (https://github.com/racer-rust/racer).
Specifically for WASM, RLS has an issue tracking it: https://github.com/rust-lang/rls/issues/1489
I haven't tried with web-sys specifically, but I have disabled the RLS extension and added the rust-analyzer extension in its place and it has been working much smoother so far.
I do sometimes get hints/docs about how a function within the library is used if I write the name (without being helped by intellisense along the way). I also get a red line below if I try to use something that doesn't exist. But no autocomplete.
Here I get autocomplete:

No autocomplete:

And yet I get a hint when I write parse correctly:

I haven't tried with
web-sysspecifically, but I have disabled the RLS extension and added the rust-analyzer extension in its place and it has been working much smoother so far.
I just encountered this issue with rust-analyzer myself.

You can see that even annotating it as being a Window struct, it still gives an {unknown}

(As a side note, you can set "rust-client.engine": "rust-analyzer" and use it directly from the same extension)
(As a side note, you can set
"rust-client.engine": "rust-analyzer"and use it directly from the same extension)
I had the same problem, after setting rust-client.engine I restarted vs code and I got a prompt to install the nightly build of rust-analyzer. Everything works as expected now!
Working through the rust book right now, and VSCode wasn't autocompleting gen_range in the Guessing Game tutorial. Switching to rust-analyzer as above fixes autocomplete for me. As a new user, it is _very_ confusing if the functions used in the tutorial in the book don't autocomplete.
VSCode wasn't autocompleting. Switching to rust-analyzer as above fixes autocomplete for me. Also had to set rust auto update before it installed.
Thanks for the hint. :)
I have experienced an issue though.
Switching to rust-analyzer works for me and auto-completes e.g. gen_range but now warnings and errors will only be displayed in VSCode after manually building the project. It works automatically with the standard engine (which is rls, I guess). Any ideas how to fix this?
@visuallization it's a known limitation of rust-analyzer, but you don't have to build the project manually since it runs cargo check on save. Moreso, you can use the auto-save feature of Code.
If the rust-analyzer download doesn't work, open VSCode Settings and set Rust-analyzer: Release Tag to 2020-08-31. Note that stable and beta don't work. See #847.
Most helpful comment
I'm having the same problem. Is there any update on this?