Support completion for macros

This commit is contained in:
uHOOCCOOHu 2019-09-10 13:32:47 +08:00
parent e2ebb467bd
commit 7de9537ccc
No known key found for this signature in database
GPG key ID: CED392DE0C483D00
4 changed files with 295 additions and 2 deletions

View file

@ -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()",
},
]"###
);
}