expose config for hover struct field display

This commit is contained in:
Young-Flash 2024-03-21 17:56:49 +08:00
parent 6f6b03f9de
commit d81148a009
3 changed files with 17 additions and 0 deletions

View file

@ -375,6 +375,8 @@ config_data! {
/// How to render the size information in a memory layout hover.
hover_memoryLayout_size: Option<MemoryLayoutHoverRenderKindDef> = "\"both\"",
/// How many fields of a struct to display when hovering a struct.
hover_show_structFields: Option<usize> = "null",
/// How many associated items of a trait to display when hovering a trait.
hover_show_traitAssocItems: Option<usize> = "null",
@ -1690,6 +1692,7 @@ impl Config {
},
keywords: self.data.hover_documentation_keywords_enable,
max_trait_assoc_items_count: self.data.hover_show_traitAssocItems,
max_struct_field_count: self.data.hover_show_structFields,
}
}

View file

@ -520,6 +520,11 @@ How to render the offset information in a memory layout hover.
--
How to render the size information in a memory layout hover.
--
[[rust-analyzer.hover.show.structFields]]rust-analyzer.hover.show.structFields (default: `null`)::
+
--
How many fields of a struct to display when hovering a struct.
--
[[rust-analyzer.hover.show.traitAssocItems]]rust-analyzer.hover.show.traitAssocItems (default: `null`)::
+
--

View file

@ -1144,6 +1144,15 @@
}
]
},
"rust-analyzer.hover.show.structFields": {
"markdownDescription": "How many fields of a struct to display when hovering a struct.",
"default": null,
"type": [
"null",
"integer"
],
"minimum": 0
},
"rust-analyzer.hover.show.traitAssocItems": {
"markdownDescription": "How many associated items of a trait to display when hovering a trait.",
"default": null,