mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Only run completion functions if their corresponding context is active
This commit is contained in:
parent
d97a8ee865
commit
00fdb4a3d8
29 changed files with 562 additions and 397 deletions
|
@ -6,7 +6,9 @@ use itertools::Itertools;
|
|||
use syntax::SmolStr;
|
||||
|
||||
use crate::{
|
||||
context::{ParamKind, PathCompletionCtx, PatternContext},
|
||||
context::{
|
||||
IdentContext, NameRefContext, NameRefKind, ParamKind, PathCompletionCtx, PatternContext,
|
||||
},
|
||||
render::{variant::visible_fields, RenderContext},
|
||||
CompletionItem, CompletionItemKind,
|
||||
};
|
||||
|
@ -78,8 +80,11 @@ fn render_pat(
|
|||
fields_omitted: bool,
|
||||
) -> Option<String> {
|
||||
let has_call_parens = matches!(
|
||||
ctx.completion.path_context(),
|
||||
Some(PathCompletionCtx { has_call_parens: true, .. })
|
||||
ctx.completion.ident_ctx,
|
||||
IdentContext::NameRef(NameRefContext {
|
||||
kind: Some(NameRefKind::Path(PathCompletionCtx { has_call_parens: true, .. })),
|
||||
..
|
||||
})
|
||||
);
|
||||
let mut pat = match kind {
|
||||
StructKind::Tuple if !has_call_parens => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue