New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: avoid adding enum parens in use path #12473
Conversation
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 | ||
} | ||
_ => true, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is similar to
rust-analyzer/crates/ide-completion/src/render/function.rs
Lines 201 to 210 in 995a17f
match ctx.path_context() { | |
Some(PathCompletionCtx { kind: PathKind::Expr { .. }, has_call_parens: true, .. }) => { | |
return false | |
} | |
Some(PathCompletionCtx { kind: PathKind::Use | PathKind::Type { .. }, .. }) => { | |
cov_mark::hit!(no_parens_in_use_item); | |
return false; | |
} | |
_ => {} | |
}; |
has_call_parens: true
to PathKind::Expr
// only show name in label if not adding parens | ||
if !should_add_parens { | ||
kind = StructKind::Unit; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels strange to me when completion labels still have parens
Thanks! |
📌 Commit 11693da has been approved by |
☀️ Test successful - checks-actions |
close #12420