diff options
Diffstat (limited to 'crates/ra_ide/src/completion/completion_context.rs')
-rw-r--r-- | crates/ra_ide/src/completion/completion_context.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs index d867ff6b2..f9d4154d8 100644 --- a/crates/ra_ide/src/completion/completion_context.rs +++ b/crates/ra_ide/src/completion/completion_context.rs | |||
@@ -190,19 +190,16 @@ impl<'a> CompletionContext<'a> { | |||
190 | // suggest declaration names, see `CompletionKind::Magic`. | 190 | // suggest declaration names, see `CompletionKind::Magic`. |
191 | if let Some(name) = find_node_at_offset::<ast::Name>(&file_with_fake_ident, offset) { | 191 | if let Some(name) = find_node_at_offset::<ast::Name>(&file_with_fake_ident, offset) { |
192 | if let Some(bind_pat) = name.syntax().ancestors().find_map(ast::BindPat::cast) { | 192 | if let Some(bind_pat) = name.syntax().ancestors().find_map(ast::BindPat::cast) { |
193 | let mut parent = bind_pat.syntax().parent(); | 193 | let parent = bind_pat.syntax().parent(); |
194 | if parent.clone().and_then(ast::MatchArm::cast).is_some() | 194 | if parent.clone().and_then(ast::MatchArm::cast).is_some() |
195 | || parent.clone().and_then(ast::Condition::cast).is_some() | 195 | || parent.clone().and_then(ast::Condition::cast).is_some() |
196 | { | 196 | { |
197 | self.is_pat_binding = true; | 197 | self.is_pat_binding = true; |
198 | } | 198 | } |
199 | 199 | ||
200 | while let Some(_) = parent.clone().and_then(ast::TupleStructPat::cast) { | 200 | let bind_pat_string = bind_pat.syntax().to_string(); |
201 | parent = parent.and_then(|p| p.parent()); | 201 | if !bind_pat_string.contains("ref ") && !bind_pat_string.contains(" @ ") { |
202 | if parent.clone().and_then(ast::MatchArm::cast).is_some() { | 202 | self.is_pat_binding_and_path = true; |
203 | self.is_pat_binding_and_path = true; | ||
204 | break; | ||
205 | } | ||
206 | } | 203 | } |
207 | } | 204 | } |
208 | if is_node::<ast::Param>(name.syntax()) { | 205 | if is_node::<ast::Param>(name.syntax()) { |