Skip to content

Commit eedadd7

Browse files
committed
Add support for doc on hover for macro 2.0
1 parent 4520002 commit eedadd7

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

crates/ide/src/hover.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,6 +1234,37 @@ fn f() { fo$0o!(); }
12341234
)
12351235
}
12361236

1237+
#[test]
1238+
fn test_hover_macro2_invocation() {
1239+
check(
1240+
r#"
1241+
/// foo bar
1242+
///
1243+
/// foo bar baz
1244+
macro foo() {}
1245+
1246+
fn f() { fo$0o!(); }
1247+
"#,
1248+
expect![[r#"
1249+
*foo*
1250+
1251+
```rust
1252+
test
1253+
```
1254+
1255+
```rust
1256+
macro foo
1257+
```
1258+
1259+
---
1260+
1261+
foo bar
1262+
1263+
foo bar baz
1264+
"#]],
1265+
)
1266+
}
1267+
12371268
#[test]
12381269
fn test_hover_tuple_field() {
12391270
check(

crates/syntax/src/parsing/text_tree_sink.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ fn n_attached_trivias<'a>(
147147
trivias: impl Iterator<Item = (SyntaxKind, &'a str)>,
148148
) -> usize {
149149
match kind {
150-
MACRO_CALL | MACRO_RULES | CONST | TYPE_ALIAS | STRUCT | UNION | ENUM | VARIANT | FN
151-
| TRAIT | MODULE | RECORD_FIELD | STATIC | USE => {
150+
MACRO_CALL | MACRO_RULES | MACRO_DEF | CONST | TYPE_ALIAS | STRUCT | UNION | ENUM
151+
| VARIANT | FN | TRAIT | MODULE | RECORD_FIELD | STATIC | USE => {
152152
let mut res = 0;
153153
let mut trivias = trivias.enumerate().peekable();
154154

0 commit comments

Comments
 (0)