mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-26 05:14:14 +00:00
Introduce NameRefContext
This commit is contained in:
parent
1dc83f5a90
commit
6a045c7029
20 changed files with 145 additions and 106 deletions
|
@ -7,9 +7,8 @@ use stdx::{format_to, to_lower_snake_case};
|
|||
use syntax::SmolStr;
|
||||
|
||||
use crate::{
|
||||
context::{CompletionContext, PathCompletionCtx, PathKind},
|
||||
context::{CompletionContext, DotAccess, NameRefContext, PathCompletionCtx, PathKind},
|
||||
item::{Builder, CompletionItem, CompletionItemKind, CompletionRelevance},
|
||||
patterns::ImmediateLocation,
|
||||
render::{compute_exact_name_match, compute_ref_match, compute_type_match, RenderContext},
|
||||
};
|
||||
|
||||
|
@ -196,7 +195,7 @@ fn should_add_parens(ctx: &CompletionContext) -> bool {
|
|||
return false;
|
||||
}
|
||||
|
||||
match ctx.path_context {
|
||||
match ctx.path_context() {
|
||||
Some(PathCompletionCtx { kind: PathKind::Expr { .. }, has_call_parens: true, .. }) => {
|
||||
return false
|
||||
}
|
||||
|
@ -208,8 +207,8 @@ fn should_add_parens(ctx: &CompletionContext) -> bool {
|
|||
};
|
||||
|
||||
if matches!(
|
||||
ctx.completion_location,
|
||||
Some(ImmediateLocation::MethodCall { has_parens: true, .. })
|
||||
ctx.nameref_ctx,
|
||||
Some(NameRefContext { dot_access: Some(DotAccess::Method { has_parens: true, .. }), .. })
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue