-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Autoimport completion doesn't suggest std::env::var #6594
Comments
Hmm, seems to work for me on a dummy project: As an idea, this can be caused by overwhelming number of various modules returned from Currently, So, what we end up currently after a fuzzy search are all results that contain the letters But for some noisy cases it's not enough. A assume it might be relatively straightforward to add a filter that considers the result type, since import map already stores this information in |
Now when we filter out the modules eagerly, did it become better for you? |
I've noticed the I've run a few tests and looks like after I've excluded the modues from the search results, we're still not showing the Current reasons are the limits we put: for rust-analyzer, there are 45 index entries for the word First, we limit the search results in the query itself, with 50 entries: and then attempt to speed up the things even more and limit them with 20 entries: and there we loose the required method. I've looked at the way it's done in intellij-rust and looks like they don't really have the limits at all: #6614 (comment) IMO we can safely remove the first one (50), but the second one is not that simple: rendering the import edits is our current performance bottleneck: #6633 (comment) The resolve approach masks the issue for the majority of the users (since our client supports the resolve capability): I see the following alternatives:
I'm leaning towards the hybrid of the first and the last approaches, but please share your thoughts, if you have any. |
Why do you think the resolve approach might not be enough? Just because resolve isn't supported by all editors? I think we could maybe disable autoimport completions by default if resolve isn't supported. |
Yes, due to the other editor implementations. I fear our client easily can be the only one doing that and we will just "break" this completion for the current users. Sure, we can disable the completions completely on such case, but then we need to desice what to do with the feature toggle: #6631 |
I think this is the right approach for things that are expensive to compute. |
🤔 But we can invert the setting and call it "Disable autoimporst on completion" or whatever and keep it |
Yeah, I don't know if we can dynamically change the default. I think it'd also be fine to completely disable the feature if resolve isn't supported. I feel like there's some precedent for this in the fact that some assists are disabled if there is no snippet support. It's admittedly not very discoverable, but we could at least document it, and we should push the clients to implement resolve support anyway. As for the feature toggle, I personally think we should just have a |
Not sure why. This is in the rust-analyzer source e.g. in
main
, just typingvar
;std::env::vars_os
andstd::env::set_var
are suggested, but notstd::env::var
. Typingvar
and using the autoimport code action works.The text was updated successfully, but these errors were encountered: