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
This commit is contained in:
Tim Hutt 2025-02-21 20:01:33 +00:00
parent 83ff2c91fa
commit 8d91f1cc17

View File

@ -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(