diff options
author | Aleksey Kladov <[email protected]> | 2020-05-04 15:48:50 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-05-04 15:48:50 +0100 |
commit | b211c5814e994a411095e4392d804d692d58d43b (patch) | |
tree | e20ff0abaa05597cf559cb5f1d4f83eb7d1f326e /crates/ra_ide/src/completion/complete_unqualified_path.rs | |
parent | 8f4478390e29f34c5530a25bd0338b689218677f (diff) |
Remove false positive attr compleitons
Diffstat (limited to 'crates/ra_ide/src/completion/complete_unqualified_path.rs')
-rw-r--r-- | crates/ra_ide/src/completion/complete_unqualified_path.rs | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/crates/ra_ide/src/completion/complete_unqualified_path.rs b/crates/ra_ide/src/completion/complete_unqualified_path.rs index a6a5568de..bd40af1cb 100644 --- a/crates/ra_ide/src/completion/complete_unqualified_path.rs +++ b/crates/ra_ide/src/completion/complete_unqualified_path.rs | |||
@@ -8,9 +8,12 @@ use hir::{Adt, ModuleDef, Type}; | |||
8 | use ra_syntax::AstNode; | 8 | use ra_syntax::AstNode; |
9 | 9 | ||
10 | pub(super) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionContext) { | 10 | pub(super) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionContext) { |
11 | if (!ctx.is_trivial_path && !ctx.is_pat_binding_or_const) | 11 | if !(ctx.is_trivial_path || ctx.is_pat_binding_or_const) { |
12 | || ctx.record_lit_syntax.is_some() | 12 | return; |
13 | } | ||
14 | if ctx.record_lit_syntax.is_some() | ||
13 | || ctx.record_pat_syntax.is_some() | 15 | || ctx.record_pat_syntax.is_some() |
16 | || ctx.attribute_under_caret.is_some() | ||
14 | { | 17 | { |
15 | return; | 18 | return; |
16 | } | 19 | } |
@@ -1369,4 +1372,18 @@ mod tests { | |||
1369 | "### | 1372 | "### |
1370 | ) | 1373 | ) |
1371 | } | 1374 | } |
1375 | |||
1376 | #[test] | ||
1377 | fn dont_complete_attr() { | ||
1378 | assert_debug_snapshot!( | ||
1379 | do_reference_completion( | ||
1380 | r" | ||
1381 | struct Foo; | ||
1382 | #[<|>] | ||
1383 | fn f() {} | ||
1384 | " | ||
1385 | ), | ||
1386 | @r###"[]"### | ||
1387 | ) | ||
1388 | } | ||
1372 | } | 1389 | } |