mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Simplify CompletionContext by introducing a path CallKind enum
This commit is contained in:
parent
ad9234fef2
commit
e475bcdcc6
6 changed files with 49 additions and 32 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
use itertools::Itertools;
|
||||
|
||||
use crate::{item::Builder, CompletionContext};
|
||||
use crate::{context::CallKind, item::Builder, patterns::ImmediateLocation, CompletionContext};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(super) enum Params {
|
||||
|
@ -32,10 +32,12 @@ impl Builder {
|
|||
cov_mark::hit!(no_parens_in_use_item);
|
||||
return false;
|
||||
}
|
||||
if ctx.is_pattern_call {
|
||||
return false;
|
||||
}
|
||||
if ctx.is_call {
|
||||
if matches!(ctx.path_call_kind(), Some(CallKind::Expr) | Some(CallKind::Pat))
|
||||
| matches!(
|
||||
ctx.completion_location,
|
||||
Some(ImmediateLocation::MethodCall { has_parens: true, .. })
|
||||
)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue