Skip to content

Commit 4ab9329

Browse files
committed
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 rust-lang#9850
1 parent 8a493b1 commit 4ab9329

File tree

1 file changed

+4
-1
lines changed
  • src/tools/rust-analyzer/crates/ide-completion/src/completions

1 file changed

+4
-1
lines changed

src/tools/rust-analyzer/crates/ide-completion/src/completions/expr.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,10 @@ pub(crate) fn complete_expr_path(
147147
});
148148
match resolution {
149149
hir::PathResolution::Def(hir::ModuleDef::Module(module)) => {
150-
let module_scope = module.scope(ctx.db, Some(ctx.module));
150+
// Set visible_from to None so private items are returned.
151+
// They will be possibly filtered out in add_path_resolution()
152+
// via def_is_visible().
153+
let module_scope = module.scope(ctx.db, None);
151154
for (name, def) in module_scope {
152155
if scope_def_applicable(def) {
153156
acc.add_path_resolution(

0 commit comments

Comments
 (0)