Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/render/literal.rs')
| -rw-r--r-- | crates/ide-completion/src/render/literal.rs | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/crates/ide-completion/src/render/literal.rs b/crates/ide-completion/src/render/literal.rs index fd76dedad0..1e03d066d1 100644 --- a/crates/ide-completion/src/render/literal.rs +++ b/crates/ide-completion/src/render/literal.rs @@ -4,7 +4,9 @@ use hir::{db::HirDatabase, Documentation, HasAttrs, StructKind}; use ide_db::SymbolKind; use crate::{ - context::{CompletionContext, PathCompletionCtx, PathKind}, + context::{ + CompletionContext, IdentContext, NameRefContext, NameRefKind, PathCompletionCtx, PathKind, + }, item::{Builder, CompletionItem}, render::{ compute_ref_match, compute_type_match, @@ -51,12 +53,19 @@ fn render( ) -> Option<Builder> { let db = completion.db; let mut kind = thing.kind(db); - let should_add_parens = match completion.path_context() { - Some(PathCompletionCtx { has_call_parens: true, .. }) => false, - Some(PathCompletionCtx { kind: PathKind::Use | PathKind::Type { .. }, .. }) => { - cov_mark::hit!(no_parens_in_use_item); - false - } + let should_add_parens = match &completion.ident_ctx { + IdentContext::NameRef(NameRefContext { + kind: Some(NameRefKind::Path(PathCompletionCtx { has_call_parens: true, .. })), + .. + }) => false, + IdentContext::NameRef(NameRefContext { + kind: + Some(NameRefKind::Path(PathCompletionCtx { + kind: PathKind::Use | PathKind::Type { .. }, + .. + })), + .. + }) => false, _ => true, }; |