about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTim Hutt <tdhutt@gmail.com>2025-02-21 20:01:33 +0000
committerTim Hutt <tdhutt@gmail.com>2025-02-23 13:25:53 +0000
commit4ab9329699392901e7b0f2b3000923a6e15380cb (patch)
tree472bdbb3e583f0d956e53cd5c87478c602c894f7
parent8a493b1a303470376275e04f03632423b6f7916f (diff)
downloadrust-4ab9329699392901e7b0f2b3000923a6e15380cb.tar.gz
rust-4ab9329699392901e7b0f2b3000923a6e15380cb.zip
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
-rw-r--r--src/tools/rust-analyzer/crates/ide-completion/src/completions/expr.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/completions/expr.rs b/src/tools/rust-analyzer/crates/ide-completion/src/completions/expr.rs
index e7101751701..365d2dde7e9 100644
--- a/src/tools/rust-analyzer/crates/ide-completion/src/completions/expr.rs
+++ b/src/tools/rust-analyzer/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(