-
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
private visibility is shown in autocompletion #15134
Comments
I might be missing something in the crate/module setup that isn't being propagated
@asyncci Can you please help me reproduce your failure. I recreated a test case from your screenshots here master...petr-tik:rust-analyzer:n15134_hide_private_from_autocomplete but I am not seeing What is the name of the file where function and function2 are defined? Are they nested in a module? |
@rustbot claim |
Hello again ! Sorry for late response . Here is it https://github.com/asyncci/physarum . I've checked again, same as on screenshots |
Before Private functions have RawVisibility module, but were missed because take_types returned None early. After resolve_visibility returned None, Visibility::Public was set instead and private functions ended up being offered in autocompletion. Choosing such a function results in an immediate error diagnostic about using a private function. After Pattern match of take_types that returns None and query for Module-level visibility from the original_module Fix rust-lang#15134 - tested with a unit test and a manual end-to-end test of building rust-analyzer from my branch and opening the reproduction repository REVIEW Refactor to move scope_def_applicable and check function visibility from a module Please let me know what's the best way to add a unit tests to nameres, which is where the root cause was
@asyncci hey would appreciate if you could build rust-analyzer from my PR branch and test drive it in your project. When I tried it, only the public function were offered as completions, so I would appreciate if I missed anything |
Yes of course, but I’m not at home currently , probably in two-three days . Is that okay? |
…_2, r=Veykril fix: Fix item tree lowering pub(self) to pub() Prior to this, the item tree lowered `pub(self)` visibility to `pub()` Fix #15134 - tested with a unit test and a manual end-to-end test of building rust-analyzer from my branch and opening the reproduction repository
Before Private functions have RawVisibility module, but were missed because take_types returned None early. After resolve_visibility returned None, Visibility::Public was set instead and private functions ended up being offered in autocompletion. Choosing such a function results in an immediate error diagnostic about using a private function. After Pattern match of take_types that returns None and query for Module-level visibility from the original_module Fix rust-lang#15134 - tested with a unit test and a manual end-to-end test of building rust-analyzer from my branch and opening the reproduction repository REVIEW Refactor to move scope_def_applicable and check function visibility from a module Please let me know what's the best way to add a unit tests to nameres, which is where the root cause was
I have
pub(self) fn function() {}
in module namedbecoding
, and autocomplete in outer files shows that function .but the error is ok
But when it comes to
pub(in crate::becoding)fn function(){}
, autocomplete hides that function .The text was updated successfully, but these errors were encountered: