From 7de9537cccc7a6338bcd9c892a1fdb4a6008dc1a Mon Sep 17 00:00:00 2001 From: uHOOCCOOHu Date: Tue, 10 Sep 2019 13:32:47 +0800 Subject: Support completion for macros --- crates/ra_ide_api/src/completion/complete_path.rs | 36 +++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'crates/ra_ide_api/src/completion/complete_path.rs') diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs index d6b5ac9ad..55c78d305 100644 --- a/crates/ra_ide_api/src/completion/complete_path.rs +++ b/crates/ra_ide_api/src/completion/complete_path.rs @@ -584,6 +584,42 @@ mod tests { kind: Function, detail: "fn foo()", }, +]"### + ); + } + + #[test] + fn completes_quantified_macros() { + assert_debug_snapshot!( + do_reference_completion( + " + #[macro_export] + macro_rules! foo { + () => {} + } + + fn main() { + let _ = crate::<|> + } + " + ), + @r###"[ + CompletionItem { + label: "foo", + source_range: [179; 179), + delete: [179; 179), + insert: "foo!", + kind: Macro, + detail: "#[macro_export]\nmacro_rules! foo", + }, + CompletionItem { + label: "main", + source_range: [179; 179), + delete: [179; 179), + insert: "main()$0", + kind: Function, + detail: "fn main()", + }, ]"### ); } -- cgit v1.2.3