rust-analyzer/crates/ide-completion/src
petr-tik 2d879e0431 Stop offering private functions in completions
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 #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
2023-12-08 11:38:54 +01:00
..
completions Stop offering private functions in completions 2023-12-08 11:38:54 +01:00
context Merge commit '9b3d03408c66749d56466bb09baf2a7177deb6ce' into sync-from-ra 2023-08-21 12:44:09 +03:00
render split detail function 2023-09-23 19:43:19 -03:00
tests Stop offering private functions in completions 2023-12-08 11:38:54 +01:00
completions.rs 🧹 2023-11-28 10:55:40 +01:00
config.rs Add config for preferring / ignoring prelude modules in find_path 2023-11-11 14:56:38 +01:00
context.rs Merge commit '9b3d03408c66749d56466bb09baf2a7177deb6ce' into sync-from-ra 2023-08-21 12:44:09 +03:00
item.rs fix: add fallback for completion label details 2023-11-25 13:25:42 +02:00
lib.rs Don't explicitly warn against semicolon_in_expressions_from_macros 2023-12-05 11:35:09 +01:00
render.rs Insert fn call parens only if the parens inserted around field name 2023-12-04 22:37:34 +05:30
snippet.rs Add config for preferring / ignoring prelude modules in find_path 2023-11-11 14:56:38 +01:00
tests.rs Update tests 2023-11-24 14:38:00 +02:00