Unnamed repository; edit this file 'description' to name the repository.
Include private items in completions for local crates
Don't filter out private items when completing paths in the same crate. Instead respect the `privateEditable` setting. Fixes #9850
Tim Hutt 2025-02-23
parent 83ff2c9 · commit 8d91f1c
-rw-r--r--crates/ide-completion/src/completions/expr.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/ide-completion/src/completions/expr.rs b/crates/ide-completion/src/completions/expr.rs
index e710175170..365d2dde7e 100644
--- a/crates/ide-completion/src/completions/expr.rs
+++ b/crates/ide-completion/src/completions/expr.rs
@@ -147,7 +147,10 @@ pub(crate) fn complete_expr_path(
});
match resolution {
hir::PathResolution::Def(hir::ModuleDef::Module(module)) => {
- let module_scope = module.scope(ctx.db, Some(ctx.module));
+ // Set visible_from to None so private items are returned.
+ // They will be possibly filtered out in add_path_resolution()
+ // via def_is_visible().
+ let module_scope = module.scope(ctx.db, None);
for (name, def) in module_scope {
if scope_def_applicable(def) {
acc.add_path_resolution(