aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/completion
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/completion')
-rw-r--r--crates/ra_ide/src/completion/completion_context.rs8
-rw-r--r--crates/ra_ide/src/completion/patterns.rs2
2 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs
index 2a5f3c3d2..6b03b30bb 100644
--- a/crates/ra_ide/src/completion/completion_context.rs
+++ b/crates/ra_ide/src/completion/completion_context.rs
@@ -265,7 +265,7 @@ impl<'a> CompletionContext<'a> {
265 return; 265 return;
266 } 266 }
267 // FIXME: remove this (V) duplication and make the check more precise 267 // FIXME: remove this (V) duplication and make the check more precise
268 if name_ref.syntax().ancestors().find_map(ast::RecordFieldPatList::cast).is_some() { 268 if name_ref.syntax().ancestors().find_map(ast::RecordPatFieldList::cast).is_some() {
269 self.record_pat_syntax = 269 self.record_pat_syntax =
270 self.sema.find_node_at_offset_with_macros(&original_file, offset); 270 self.sema.find_node_at_offset_with_macros(&original_file, offset);
271 } 271 }
@@ -275,7 +275,7 @@ impl<'a> CompletionContext<'a> {
275 // Otherwise, see if this is a declaration. We can use heuristics to 275 // Otherwise, see if this is a declaration. We can use heuristics to
276 // suggest declaration names, see `CompletionKind::Magic`. 276 // suggest declaration names, see `CompletionKind::Magic`.
277 if let Some(name) = find_node_at_offset::<ast::Name>(&file_with_fake_ident, offset) { 277 if let Some(name) = find_node_at_offset::<ast::Name>(&file_with_fake_ident, offset) {
278 if let Some(bind_pat) = name.syntax().ancestors().find_map(ast::BindPat::cast) { 278 if let Some(bind_pat) = name.syntax().ancestors().find_map(ast::IdentPat::cast) {
279 self.is_pat_binding_or_const = true; 279 self.is_pat_binding_or_const = true;
280 if bind_pat.at_token().is_some() 280 if bind_pat.at_token().is_some()
281 || bind_pat.ref_token().is_some() 281 || bind_pat.ref_token().is_some()
@@ -283,7 +283,7 @@ impl<'a> CompletionContext<'a> {
283 { 283 {
284 self.is_pat_binding_or_const = false; 284 self.is_pat_binding_or_const = false;
285 } 285 }
286 if bind_pat.syntax().parent().and_then(ast::RecordFieldPatList::cast).is_some() { 286 if bind_pat.syntax().parent().and_then(ast::RecordPatFieldList::cast).is_some() {
287 self.is_pat_binding_or_const = false; 287 self.is_pat_binding_or_const = false;
288 } 288 }
289 if let Some(let_stmt) = bind_pat.syntax().ancestors().find_map(ast::LetStmt::cast) { 289 if let Some(let_stmt) = bind_pat.syntax().ancestors().find_map(ast::LetStmt::cast) {
@@ -300,7 +300,7 @@ impl<'a> CompletionContext<'a> {
300 return; 300 return;
301 } 301 }
302 // FIXME: remove this (^) duplication and make the check more precise 302 // FIXME: remove this (^) duplication and make the check more precise
303 if name.syntax().ancestors().find_map(ast::RecordFieldPatList::cast).is_some() { 303 if name.syntax().ancestors().find_map(ast::RecordPatFieldList::cast).is_some() {
304 self.record_pat_syntax = 304 self.record_pat_syntax =
305 self.sema.find_node_at_offset_with_macros(&original_file, offset); 305 self.sema.find_node_at_offset_with_macros(&original_file, offset);
306 } 306 }
diff --git a/crates/ra_ide/src/completion/patterns.rs b/crates/ra_ide/src/completion/patterns.rs
index 9e654b373..7c4feff6d 100644
--- a/crates/ra_ide/src/completion/patterns.rs
+++ b/crates/ra_ide/src/completion/patterns.rs
@@ -44,7 +44,7 @@ fn test_has_block_expr_parent() {
44} 44}
45 45
46pub(crate) fn has_bind_pat_parent(element: SyntaxElement) -> bool { 46pub(crate) fn has_bind_pat_parent(element: SyntaxElement) -> bool {
47 element.ancestors().find(|it| it.kind() == BIND_PAT).is_some() 47 element.ancestors().find(|it| it.kind() == IDENT_PAT).is_some()
48} 48}
49#[test] 49#[test]
50fn test_has_bind_pat_parent() { 50fn test_has_bind_pat_parent() {