diff options
author | uHOOCCOOHu <[email protected]> | 2019-09-11 15:44:44 +0100 |
---|---|---|
committer | uHOOCCOOHu <[email protected]> | 2019-09-11 15:44:44 +0100 |
commit | 6353b1621f44e1b0db65ebbe414aa7c5f1864b9d (patch) | |
tree | dd32501321994bc8e9dcacd634cb4511053b20bf /crates/ra_ide_api/src/completion/complete_scope.rs | |
parent | c033d18700e86c9bb028344f28e2eb7d670fe241 (diff) |
Split out `complete_macro_in_item_position`
Diffstat (limited to 'crates/ra_ide_api/src/completion/complete_scope.rs')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_scope.rs | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs index e2e1d7872..2062e7300 100644 --- a/crates/ra_ide_api/src/completion/complete_scope.rs +++ b/crates/ra_ide_api/src/completion/complete_scope.rs | |||
@@ -6,15 +6,6 @@ use rustc_hash::FxHashMap; | |||
6 | use crate::completion::{CompletionContext, CompletionItem, CompletionKind, Completions}; | 6 | use crate::completion::{CompletionContext, CompletionItem, CompletionKind, Completions}; |
7 | 7 | ||
8 | pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) { | 8 | pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) { |
9 | // Show only macros in top level. | ||
10 | if ctx.is_new_item { | ||
11 | for (name, res) in ctx.analyzer.all_names(ctx.db) { | ||
12 | if res.get_macros().is_some() { | ||
13 | acc.add_resolution(ctx, name.to_string(), &res.only_macros()); | ||
14 | } | ||
15 | } | ||
16 | } | ||
17 | |||
18 | if !ctx.is_trivial_path { | 9 | if !ctx.is_trivial_path { |
19 | return; | 10 | return; |
20 | } | 11 | } |
@@ -733,32 +724,4 @@ mod tests { | |||
733 | ]"## | 724 | ]"## |
734 | ); | 725 | ); |
735 | } | 726 | } |
736 | |||
737 | #[test] | ||
738 | fn completes_macros_as_item() { | ||
739 | assert_debug_snapshot!( | ||
740 | do_reference_completion( | ||
741 | " | ||
742 | //- /main.rs | ||
743 | macro_rules! foo { | ||
744 | () => {} | ||
745 | } | ||
746 | |||
747 | fn foo() {} | ||
748 | |||
749 | <|> | ||
750 | " | ||
751 | ), | ||
752 | @r##"[ | ||
753 | CompletionItem { | ||
754 | label: "foo", | ||
755 | source_range: [46; 46), | ||
756 | delete: [46; 46), | ||
757 | insert: "foo!", | ||
758 | kind: Macro, | ||
759 | detail: "macro_rules! foo", | ||
760 | }, | ||
761 | ]"## | ||
762 | ); | ||
763 | } | ||
764 | } | 727 | } |