-
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
feat: Allow excluding specific traits from completion #18179
feat: Allow excluding specific traits from completion #18179
Conversation
61667ba
to
1878d26
Compare
3699f48
to
39d3441
Compare
☔ The latest upstream changes (presumably #18167) made this pull request unmergeable. Please resolve the merge conflicts. |
addd4fd
to
1d9543f
Compare
☔ The latest upstream changes (presumably #18291) made this pull request unmergeable. Please resolve the merge conflicts. |
So, I am finally coming back to this (apologies, I forgot about it!) and have since seen the PR to IJ that added similar things intellij-rust/intellij-rust#9123. They have apparently two types of exclusion, they allow excluding completions of only the traits methods, or the methods as well as the trait itself. I think we wanna stick with what we have here for now, but make the config more general. That is instead of |
Relevant issue #13786 (comment) |
To be accurate, only their methods are excluded, the trait themselves are still available. I also excluded a bunch of std traits by default. Some less opinionated, like `AsRef`, which should never be used directly except in generic scenarios (and won't be excluded there), some more opinionated, like the ops traits, which I know some users sometimes want to use directly. Either way it's configurable. It should be pretty easy to extend support to excluding only specific methods, but I didn't do that currently. Traits configured to be excluded are resolved in each completion request from scratch. If this proves too expensive, it is easy enough to cache them in the DB.
… the name I.e. with `fn foo()`, don't complete at `x.fo|`, but complete (with imports) for `x.foo|`, since this is less likely to have false positives. I opted to only do that for flyimport, even though for basic imports there can also be snippet completion (completing the params list for a method), since this is less universally applicable and seems not so useful.
1d9543f
to
a02a1af
Compare
f804cd0
to
fc4940f
Compare
fc4940f
to
1adc805
Compare
It should be pretty easy to extend support to excluding only specific methods, but I didn't do that currently.
Traits configured to be excluded are resolved in each completion request from scratch. If this proves too expensive, it is easy enough to cache them in the DB.
Leave #17477 open, as per @dtolnay request.