diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-09-11 15:49:57 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-09-11 15:49:57 +0100 |
commit | 6ce6744e18f25ebcde387178125d820686692df5 (patch) | |
tree | e1861982356f9905980537f962dff9560423f901 /crates/ra_ide_api/src/completion/complete_path.rs | |
parent | 7bbb039fbdd124cb6549eb67bbe7316f03ff40e8 (diff) | |
parent | 6353b1621f44e1b0db65ebbe414aa7c5f1864b9d (diff) |
Merge #1796
1796: Support completion for macros r=matklad a=uHOOCCOOHu
This is based on #1795 , and fixes #1727
Also prettify hover text of macros.
Some screenshorts below:
Completion in item place.
<img width="416" alt="Screenshot_20190910_134056" src="https://user-images.githubusercontent.com/14816024/64587159-fa72da00-d3d0-11e9-86bb-c98f169ec08d.png">
After pressing `tab`.
<img width="313" alt="Screenshot_20190910_134111" src="https://user-images.githubusercontent.com/14816024/64587160-fa72da00-d3d0-11e9-9464-21e3f6957bd7.png">
Complete macros from `std`.
<img width="588" alt="Screenshot_20190910_134147" src="https://user-images.githubusercontent.com/14816024/64587161-fb0b7080-d3d0-11e9-866e-5161f0d1b546.png">
Hover text.
<img width="521" alt="Screenshot_20190910_134242" src="https://user-images.githubusercontent.com/14816024/64587162-fb0b7080-d3d0-11e9-8f09-ad17e3f6702a.png">
Co-authored-by: uHOOCCOOHu <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/completion/complete_path.rs')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_path.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs index d6b5ac9ad..31e7dffe8 100644 --- a/crates/ra_ide_api/src/completion/complete_path.rs +++ b/crates/ra_ide_api/src/completion/complete_path.rs | |||
@@ -587,4 +587,40 @@ mod tests { | |||
587 | ]"### | 587 | ]"### |
588 | ); | 588 | ); |
589 | } | 589 | } |
590 | |||
591 | #[test] | ||
592 | fn completes_qualified_macros() { | ||
593 | assert_debug_snapshot!( | ||
594 | do_reference_completion( | ||
595 | " | ||
596 | #[macro_export] | ||
597 | macro_rules! foo { | ||
598 | () => {} | ||
599 | } | ||
600 | |||
601 | fn main() { | ||
602 | let _ = crate::<|> | ||
603 | } | ||
604 | " | ||
605 | ), | ||
606 | @r###"[ | ||
607 | CompletionItem { | ||
608 | label: "foo", | ||
609 | source_range: [179; 179), | ||
610 | delete: [179; 179), | ||
611 | insert: "foo!", | ||
612 | kind: Macro, | ||
613 | detail: "#[macro_export]\nmacro_rules! foo", | ||
614 | }, | ||
615 | CompletionItem { | ||
616 | label: "main", | ||
617 | source_range: [179; 179), | ||
618 | delete: [179; 179), | ||
619 | insert: "main()$0", | ||
620 | kind: Function, | ||
621 | detail: "fn main()", | ||
622 | }, | ||
623 | ]"### | ||
624 | ); | ||
625 | } | ||
590 | } | 626 | } |