aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/completion/complete_scope.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/completion/complete_scope.rs')
-rw-r--r--crates/ra_ide_api/src/completion/complete_scope.rs37
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;
6use crate::completion::{CompletionContext, CompletionItem, CompletionKind, Completions}; 6use crate::completion::{CompletionContext, CompletionItem, CompletionKind, Completions};
7 7
8pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) { 8pub(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}