From 8d91f1cc17d1639c1a2bd10c5497be907c1e4cb0 Mon Sep 17 00:00:00 2001 From: Tim Hutt Date: Fri, 21 Feb 2025 20:01:33 +0000 Subject: [PATCH] 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 --- crates/ide-completion/src/completions/expr.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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(