mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-14 14:13:58 +00:00
Add support for doc on hover for macro 2.0
This commit is contained in:
parent
4520002b63
commit
eedadd7024
2 changed files with 33 additions and 2 deletions
|
@ -1234,6 +1234,37 @@ fn f() { fo$0o!(); }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_hover_macro2_invocation() {
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
/// foo bar
|
||||||
|
///
|
||||||
|
/// foo bar baz
|
||||||
|
macro foo() {}
|
||||||
|
|
||||||
|
fn f() { fo$0o!(); }
|
||||||
|
"#,
|
||||||
|
expect![[r#"
|
||||||
|
*foo*
|
||||||
|
|
||||||
|
```rust
|
||||||
|
test
|
||||||
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
macro foo
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
foo bar
|
||||||
|
|
||||||
|
foo bar baz
|
||||||
|
"#]],
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_hover_tuple_field() {
|
fn test_hover_tuple_field() {
|
||||||
check(
|
check(
|
||||||
|
|
|
@ -147,8 +147,8 @@ fn n_attached_trivias<'a>(
|
||||||
trivias: impl Iterator<Item = (SyntaxKind, &'a str)>,
|
trivias: impl Iterator<Item = (SyntaxKind, &'a str)>,
|
||||||
) -> usize {
|
) -> usize {
|
||||||
match kind {
|
match kind {
|
||||||
MACRO_CALL | MACRO_RULES | CONST | TYPE_ALIAS | STRUCT | UNION | ENUM | VARIANT | FN
|
MACRO_CALL | MACRO_RULES | MACRO_DEF | CONST | TYPE_ALIAS | STRUCT | UNION | ENUM
|
||||||
| TRAIT | MODULE | RECORD_FIELD | STATIC | USE => {
|
| VARIANT | FN | TRAIT | MODULE | RECORD_FIELD | STATIC | USE => {
|
||||||
let mut res = 0;
|
let mut res = 0;
|
||||||
let mut trivias = trivias.enumerate().peekable();
|
let mut trivias = trivias.enumerate().peekable();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue