diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-02-28 15:07:33 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-28 15:07:33 +0000 |
commit | 93f632ca4e7bb7fd54830e456d629a4948a92337 (patch) | |
tree | 5f363a6b5cfeb64a446902047ce1a4610e3dc6ec /crates/ra_ide/src | |
parent | 9ef6359950fa2f3ecb9a7d4120f01e4baeaad978 (diff) | |
parent | 7a5ff0f37c5fb7d1d21ee56da0168f68e54fbca5 (diff) |
Merge #3366
3366: Simpilfy original_range logic r=matklad a=edwin0cheng
This PR fixed another [bug](https://github.com/rust-analyzer/rust-analyzer/issues/3000#issuecomment-592474844) which incorrectly map the wrong range of `punct` in macro_call and simplify the logic a little bit by introducing an `ascend_call_token` function.
Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/hover.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index 7ba4bfcac..cc79f1fab 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs | |||
@@ -739,6 +739,30 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
739 | } | 739 | } |
740 | 740 | ||
741 | #[test] | 741 | #[test] |
742 | fn test_hover_through_func_in_macro_recursive() { | ||
743 | let hover_on = check_hover_result( | ||
744 | " | ||
745 | //- /lib.rs | ||
746 | macro_rules! id_deep { | ||
747 | ($($tt:tt)*) => { $($tt)* } | ||
748 | } | ||
749 | macro_rules! id { | ||
750 | ($($tt:tt)*) => { id_deep!($($tt)*) } | ||
751 | } | ||
752 | fn bar() -> u32 { | ||
753 | 0 | ||
754 | } | ||
755 | fn foo() { | ||
756 | let a = id!([0u32, bar(<|>)] ); | ||
757 | } | ||
758 | ", | ||
759 | &["u32"], | ||
760 | ); | ||
761 | |||
762 | assert_eq!(hover_on, "bar()") | ||
763 | } | ||
764 | |||
765 | #[test] | ||
742 | fn test_hover_through_literal_string_in_macro() { | 766 | fn test_hover_through_literal_string_in_macro() { |
743 | let hover_on = check_hover_result( | 767 | let hover_on = check_hover_result( |
744 | r#" | 768 | r#" |