mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
fix: Don't show qualified path completions for private items
This commit is contained in:
parent
6b823b0234
commit
7ff6c36716
11 changed files with 122 additions and 64 deletions
|
@ -174,13 +174,19 @@ impl Completions {
|
|||
local_name: hir::Name,
|
||||
resolution: hir::ScopeDef,
|
||||
) {
|
||||
if ctx.is_scope_def_hidden(resolution) {
|
||||
cov_mark::hit!(qualified_path_doc_hidden);
|
||||
return;
|
||||
}
|
||||
let is_private_editable = match ctx.def_is_visible(&resolution) {
|
||||
Visible::Yes => false,
|
||||
Visible::Editable => true,
|
||||
Visible::No => return,
|
||||
};
|
||||
self.add(
|
||||
render_path_resolution(RenderContext::new(ctx), path_ctx, local_name, resolution)
|
||||
.build(),
|
||||
render_path_resolution(
|
||||
RenderContext::new(ctx).private_editable(is_private_editable),
|
||||
path_ctx,
|
||||
local_name,
|
||||
resolution,
|
||||
)
|
||||
.build(),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -191,13 +197,19 @@ impl Completions {
|
|||
local_name: hir::Name,
|
||||
resolution: hir::ScopeDef,
|
||||
) {
|
||||
if ctx.is_scope_def_hidden(resolution) {
|
||||
cov_mark::hit!(qualified_path_doc_hidden);
|
||||
return;
|
||||
}
|
||||
let is_private_editable = match ctx.def_is_visible(&resolution) {
|
||||
Visible::Yes => false,
|
||||
Visible::Editable => true,
|
||||
Visible::No => return,
|
||||
};
|
||||
self.add(
|
||||
render_pattern_resolution(RenderContext::new(ctx), pattern_ctx, local_name, resolution)
|
||||
.build(),
|
||||
render_pattern_resolution(
|
||||
RenderContext::new(ctx).private_editable(is_private_editable),
|
||||
pattern_ctx,
|
||||
local_name,
|
||||
resolution,
|
||||
)
|
||||
.build(),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue