fix: adjust the limitation for ADTs' fields to 5

This commit is contained in:
roife 2024-04-07 13:24:33 +08:00
parent c06d670f8f
commit 6bb85985d7
5 changed files with 7 additions and 7 deletions

View file

@ -18,7 +18,7 @@ const HOVER_BASE_CONFIG: HoverConfig = HoverConfig {
format: HoverDocFormat::Markdown, format: HoverDocFormat::Markdown,
keywords: true, keywords: true,
max_trait_assoc_items_count: None, max_trait_assoc_items_count: None,
max_adt_fields_or_variants_count: Some(10), max_adt_fields_or_variants_count: Some(5),
}; };
fn check_hover_no_result(ra_fixture: &str) { fn check_hover_no_result(ra_fixture: &str) {
@ -1018,7 +1018,7 @@ fn hover_record_struct_limit() {
#[test] #[test]
fn hover_enum_limit() { fn hover_enum_limit() {
check_hover_adt_fields_or_variants_limit( check_hover_adt_fields_or_variants_limit(
Some(10), Some(5),
r#"enum Foo$0 { A, B }"#, r#"enum Foo$0 { A, B }"#,
expect![[r#" expect![[r#"
*Foo* *Foo*
@ -1092,7 +1092,7 @@ fn hover_enum_limit() {
#[test] #[test]
fn hover_union_limit() { fn hover_union_limit() {
check_hover_adt_fields_or_variants_limit( check_hover_adt_fields_or_variants_limit(
Some(10), Some(5),
r#"union Foo$0 { a: u32, b: i32 }"#, r#"union Foo$0 { a: u32, b: i32 }"#,
expect![[r#" expect![[r#"
*Foo* *Foo*

View file

@ -167,7 +167,7 @@ impl StaticIndex<'_> {
keywords: true, keywords: true,
format: crate::HoverDocFormat::Markdown, format: crate::HoverDocFormat::Markdown,
max_trait_assoc_items_count: None, max_trait_assoc_items_count: None,
max_adt_fields_or_variants_count: Some(10), max_adt_fields_or_variants_count: Some(5),
}; };
let tokens = tokens.filter(|token| { let tokens = tokens.filter(|token| {
matches!( matches!(

View file

@ -313,7 +313,7 @@ config_data! {
hover_memoryLayout_size: Option<MemoryLayoutHoverRenderKindDef> = Some(MemoryLayoutHoverRenderKindDef::Both), hover_memoryLayout_size: Option<MemoryLayoutHoverRenderKindDef> = Some(MemoryLayoutHoverRenderKindDef::Both),
/// How many fields or variants of an ADT (struct, enum or union) to display when hovering on. Show none if empty. /// How many fields or variants of an ADT (struct, enum or union) to display when hovering on. Show none if empty.
hover_show_adtFieldsOrVariants: Option<usize> = Some(10), hover_show_adtFieldsOrVariants: Option<usize> = Some(5),
/// How many associated items of a trait to display when hovering a trait. /// How many associated items of a trait to display when hovering a trait.
hover_show_traitAssocItems: Option<usize> = None, hover_show_traitAssocItems: Option<usize> = None,

View file

@ -533,7 +533,7 @@ How to render the offset information in a memory layout hover.
-- --
How to render the size information in a memory layout hover. How to render the size information in a memory layout hover.
-- --
[[rust-analyzer.hover.show.adtFieldsOrVariants]]rust-analyzer.hover.show.adtFieldsOrVariants (default: `10`):: [[rust-analyzer.hover.show.adtFieldsOrVariants]]rust-analyzer.hover.show.adtFieldsOrVariants (default: `5`)::
+ +
-- --
How many fields or variants of an ADT (struct, enum or union) to display when hovering on. Show none if empty. How many fields or variants of an ADT (struct, enum or union) to display when hovering on. Show none if empty.

View file

@ -1154,7 +1154,7 @@
}, },
"rust-analyzer.hover.show.adtFieldsOrVariants": { "rust-analyzer.hover.show.adtFieldsOrVariants": {
"markdownDescription": "How many fields or variants of an ADT (struct, enum or union) to display when hovering on. Show none if empty.", "markdownDescription": "How many fields or variants of an ADT (struct, enum or union) to display when hovering on. Show none if empty.",
"default": 10, "default": 5,
"type": [ "type": [
"null", "null",
"integer" "integer"