-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Handle visibility (privacy) in field/method completion #824
Comments
I think, that it would be better not to filter out items, but make it less relevant and sort completion results by relevancy. Very often I forget to add pub and try to complete it somewhere else, so it is not very convenient to go there and add visibility manually. I think, that assist to add pub for not visible entry should be created. It would be much better user experience |
But do filter it out for external crates? |
It probably makes sense to treat the local source roots differently than the other ones (i.e. provide private items only from crates you can edit). |
Hiya -- i'd like to see this added. I think the optimal configuration is:
The reason for this is a few -- first, I like the Rust analyzer being able to tell me at a glance what's in scope and not in scope. Secondly, I really dislike the idea of the Rust Analyzer being willing to autocomplete something which will not compile. As a given rule, I think the Rust analyzer shouldn't suggest things which are wrong. Scope errors are one of those things. Finally, I think this could be rolled into a larger process of having the Rust Analyzer handle scope for the user much more effectively (think a help action to automatically add a using directive, like Omnisharp has for C#). Thank you! |
I think VS puts public items in front and private ones at the end, which doesn't sound so bad if you have a way to distinguish them. |
#2830 seems a duplicate of this. |
Hmm, this seems to be mostly implemented now. Is anything missing here? |
We still got two visibility related FIXMEs here https://github.com/rust-analyzer/rust-analyzer/blob/444679f202742c8fd00e9d1c7fddfaa9a067e640/crates/ide_completion/src/completions/dot.rs#L59-L78 |
We currently don't handle visibility at all. This means that we provide lots of private fields and methods for completions outside of modules where you can actually access them. We should fix this. I think the basic steps for this will be:
StructField
andFunction
(probably alsoConst
,Type
etc.)complete_dot.rs
A different, but related issue is handling visibility of items, for example when doing glob imports.
The text was updated successfully, but these errors were encountered: