Fix hover range for derive inputs

This commit is contained in:
Lukas Wirth 2021-07-31 14:47:44 +02:00
parent 7c7c4543da
commit b363755901
2 changed files with 4 additions and 4 deletions

View File

@ -155,6 +155,7 @@ pub(crate) fn hover(
if let res@Some(_) = try_hover_for_lint(&attr, &token) {
return res;
} else {
range = Some(token.text_range());
try_resolve_derive_input_at(&sema, &attr, &token).map(Definition::Macro)
}
} else {
@ -3906,7 +3907,7 @@ fn hover_derive_input() {
struct Foo;
"#,
expect![[r#"
*(Copy)*
*Copy*
```rust
test
@ -3927,7 +3928,7 @@ mod foo {
struct Foo;
"#,
expect![[r#"
*(foo::Copy)*
*Copy*
```rust
test

View File

@ -12,8 +12,7 @@
// Assist: invert_if
//
// This transforms if expressions of the form `if !x {A} else {B}` into `if x {B} else {A}`
// This also works with `!=`. This assist can only be applied with the cursor
// on `if`.
// This also works with `!=`. This assist can only be applied with the cursor on `if`.
//
// ```
// fn main() {