From e503ffe9ff175aa5f35facb107fcd985a8b1c4a4 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 17 Feb 2019 21:30:46 +0300 Subject: Don't render `()` in calls to assoc functions --- crates/ra_ide_api/src/completion/completion_context.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'crates/ra_ide_api/src/completion/completion_context.rs') diff --git a/crates/ra_ide_api/src/completion/completion_context.rs b/crates/ra_ide_api/src/completion/completion_context.rs index 82bd4d606..b9f0abe19 100644 --- a/crates/ra_ide_api/src/completion/completion_context.rs +++ b/crates/ra_ide_api/src/completion/completion_context.rs @@ -137,6 +137,13 @@ impl<'a> CompletionContext<'a> { }; if let Some(segment) = ast::PathSegment::cast(parent) { let path = segment.parent_path(); + self.is_call = path + .syntax() + .parent() + .and_then(ast::PathExpr::cast) + .and_then(|it| it.syntax().parent().and_then(ast::CallExpr::cast)) + .is_some(); + if let Some(mut path) = hir::Path::from_ast(path) { if !path.is_ident() { path.segments.pop().unwrap(); @@ -176,12 +183,6 @@ impl<'a> CompletionContext<'a> { } } } - self.is_call = path - .syntax() - .parent() - .and_then(ast::PathExpr::cast) - .and_then(|it| it.syntax().parent().and_then(ast::CallExpr::cast)) - .is_some() } if let Some(field_expr) = ast::FieldExpr::cast(parent) { // The receiver comes before the point of insertion of the fake -- cgit v1.2.3