Simplify CompletionContext by introducing a path CallKind enum

This commit is contained in:
Lukas Wirth 2021-06-06 20:02:26 +02:00
parent ad9234fef2
commit e475bcdcc6
6 changed files with 49 additions and 32 deletions

View file

@ -4,7 +4,7 @@ use hir::Semantics;
use ide_db::RootDatabase;
use syntax::{
algo::non_trivia_sibling,
ast::{self, LoopBodyOwner},
ast::{self, ArgListOwner, LoopBodyOwner},
match_ast, AstNode, Direction, SyntaxElement,
SyntaxKind::*,
SyntaxNode, SyntaxToken, TextRange, TextSize, T,
@ -39,6 +39,7 @@ pub(crate) enum ImmediateLocation {
// Original file ast node
MethodCall {
receiver: Option<ast::Expr>,
has_parens: bool,
},
// Original file ast node
FieldAccess {
@ -204,6 +205,7 @@ pub(crate) fn determine_location(
.receiver()
.map(|e| e.syntax().text_range())
.and_then(|r| find_node_with_range(original_file, r)),
has_parens: it.arg_list().map_or(false, |it| it.l_paren_token().is_some())
},
_ => return None,
}