aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/completion/completion_context.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-02-17 18:30:46 +0000
committerAleksey Kladov <[email protected]>2019-02-17 18:30:46 +0000
commite503ffe9ff175aa5f35facb107fcd985a8b1c4a4 (patch)
tree28d8072745101dacdabae1713ec07290115debfb /crates/ra_ide_api/src/completion/completion_context.rs
parent982f72c022b45629e6adbaef22884359d3495ecf (diff)
Don't render `()` in calls to assoc functions
Diffstat (limited to 'crates/ra_ide_api/src/completion/completion_context.rs')
-rw-r--r--crates/ra_ide_api/src/completion/completion_context.rs13
1 files changed, 7 insertions, 6 deletions
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> {
137 }; 137 };
138 if let Some(segment) = ast::PathSegment::cast(parent) { 138 if let Some(segment) = ast::PathSegment::cast(parent) {
139 let path = segment.parent_path(); 139 let path = segment.parent_path();
140 self.is_call = path
141 .syntax()
142 .parent()
143 .and_then(ast::PathExpr::cast)
144 .and_then(|it| it.syntax().parent().and_then(ast::CallExpr::cast))
145 .is_some();
146
140 if let Some(mut path) = hir::Path::from_ast(path) { 147 if let Some(mut path) = hir::Path::from_ast(path) {
141 if !path.is_ident() { 148 if !path.is_ident() {
142 path.segments.pop().unwrap(); 149 path.segments.pop().unwrap();
@@ -176,12 +183,6 @@ impl<'a> CompletionContext<'a> {
176 } 183 }
177 } 184 }
178 } 185 }
179 self.is_call = path
180 .syntax()
181 .parent()
182 .and_then(ast::PathExpr::cast)
183 .and_then(|it| it.syntax().parent().and_then(ast::CallExpr::cast))
184 .is_some()
185 } 186 }
186 if let Some(field_expr) = ast::FieldExpr::cast(parent) { 187 if let Some(field_expr) = ast::FieldExpr::cast(parent) {
187 // The receiver comes before the point of insertion of the fake 188 // The receiver comes before the point of insertion of the fake