fix: the fields or variants of ADT was not restricted by limitations when hovering on Self type
This commit is contained in:
parent
3994fcb245
commit
2b38652764
@ -413,6 +413,15 @@ pub(super) fn definition(
|
|||||||
Definition::Adt(adt) => {
|
Definition::Adt(adt) => {
|
||||||
adt.display_limited(db, config.max_adt_fields_or_variants_count).to_string()
|
adt.display_limited(db, config.max_adt_fields_or_variants_count).to_string()
|
||||||
}
|
}
|
||||||
|
Definition::SelfType(impl_def) => {
|
||||||
|
let self_ty = &impl_def.self_ty(db);
|
||||||
|
match self_ty.as_adt() {
|
||||||
|
Some(adt) => {
|
||||||
|
adt.display_limited(db, config.max_adt_fields_or_variants_count).to_string()
|
||||||
|
}
|
||||||
|
None => self_ty.display(db).to_string(),
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => def.label(db),
|
_ => def.label(db),
|
||||||
};
|
};
|
||||||
let docs = def.docs(db, famous_defs);
|
let docs = def.docs(db, famous_defs);
|
||||||
|
@ -1623,6 +1623,28 @@ impl Thing {
|
|||||||
test
|
test
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```rust
|
||||||
|
struct Thing {
|
||||||
|
x: u32,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
"#]],
|
||||||
|
);
|
||||||
|
check_hover_adt_fields_or_variants_limit(
|
||||||
|
None,
|
||||||
|
r#"
|
||||||
|
struct Thing { x: u32 }
|
||||||
|
impl Thing {
|
||||||
|
fn new() -> Self { Self$0 { x: 0 } }
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
expect![[r#"
|
||||||
|
*Self*
|
||||||
|
|
||||||
|
```rust
|
||||||
|
test
|
||||||
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
struct Thing
|
struct Thing
|
||||||
```
|
```
|
||||||
@ -1643,7 +1665,9 @@ impl Thing {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
struct Thing
|
struct Thing {
|
||||||
|
x: u32,
|
||||||
|
}
|
||||||
```
|
```
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
@ -1662,7 +1686,9 @@ impl Thing {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
enum Thing
|
enum Thing {
|
||||||
|
A,
|
||||||
|
}
|
||||||
```
|
```
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
@ -1681,7 +1707,9 @@ impl Thing {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
enum Thing
|
enum Thing {
|
||||||
|
A,
|
||||||
|
}
|
||||||
```
|
```
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user