Skip to content

Commit 8a6f526

Browse files
committed
expose config for hover struct field display
1 parent 5e276ae commit 8a6f526

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

crates/rust-analyzer/src/config.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ config_data! {
375375
/// How to render the size information in a memory layout hover.
376376
hover_memoryLayout_size: Option<MemoryLayoutHoverRenderKindDef> = "\"both\"",
377377

378+
/// How many fields of a struct to display when hovering a struct.
379+
hover_show_structFields: Option<usize> = "null",
378380
/// How many associated items of a trait to display when hovering a trait.
379381
hover_show_traitAssocItems: Option<usize> = "null",
380382

@@ -1690,6 +1692,7 @@ impl Config {
16901692
},
16911693
keywords: self.data.hover_documentation_keywords_enable,
16921694
max_trait_assoc_items_count: self.data.hover_show_traitAssocItems,
1695+
max_struct_field_count: self.data.hover_show_structFields,
16931696
}
16941697
}
16951698

docs/user/generated_config.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,11 @@ How to render the offset information in a memory layout hover.
520520
--
521521
How to render the size information in a memory layout hover.
522522
--
523+
[[rust-analyzer.hover.show.structFields]]rust-analyzer.hover.show.structFields (default: `null`)::
524+
+
525+
--
526+
How many fields of a struct to display when hovering a struct.
527+
--
523528
[[rust-analyzer.hover.show.traitAssocItems]]rust-analyzer.hover.show.traitAssocItems (default: `null`)::
524529
+
525530
--

editors/code/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,6 +1144,15 @@
11441144
}
11451145
]
11461146
},
1147+
"rust-analyzer.hover.show.structFields": {
1148+
"markdownDescription": "How many fields of a struct to display when hovering a struct.",
1149+
"default": null,
1150+
"type": [
1151+
"null",
1152+
"integer"
1153+
],
1154+
"minimum": 0
1155+
},
11471156
"rust-analyzer.hover.show.traitAssocItems": {
11481157
"markdownDescription": "How many associated items of a trait to display when hovering a trait.",
11491158
"default": null,

0 commit comments

Comments
 (0)