-
Notifications
You must be signed in to change notification settings - Fork 164
Intellisense/autocompletion not working for extenral crates with optional features #637
Comments
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: rust-lang/rls#1489 |
I haven't tried with |
I'm using roxmltree=0.11.0 and I think I have the same problem.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. |
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 |
I had the same problem, after setting |
Working through the rust book right now, and VSCode wasn't autocompleting |
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. :) Switching to |
@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 |
Although this may seem like a duplicate, I believe it's slightly different than other issues.
TLDR
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.
Detail
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
for those inner
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:
(I tried to play with some of those settings but didn't help!)
I am using
Please let me know if more info is needed.
The text was updated successfully, but these errors were encountered: