From 6bb85985d7449ede22c047f4692a72c1e51fe287 Mon Sep 17 00:00:00 2001 From: roife Date: Sun, 7 Apr 2024 13:24:33 +0800 Subject: [PATCH] fix: adjust the limitation for ADTs' fields to 5 --- crates/ide/src/hover/tests.rs | 6 +++--- crates/ide/src/static_index.rs | 2 +- crates/rust-analyzer/src/config.rs | 2 +- docs/user/generated_config.adoc | 2 +- editors/code/package.json | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/ide/src/hover/tests.rs b/crates/ide/src/hover/tests.rs index 30e64f450a..326c248b7a 100644 --- a/crates/ide/src/hover/tests.rs +++ b/crates/ide/src/hover/tests.rs @@ -18,7 +18,7 @@ const HOVER_BASE_CONFIG: HoverConfig = HoverConfig { format: HoverDocFormat::Markdown, keywords: true, 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) { @@ -1018,7 +1018,7 @@ fn hover_record_struct_limit() { #[test] fn hover_enum_limit() { check_hover_adt_fields_or_variants_limit( - Some(10), + Some(5), r#"enum Foo$0 { A, B }"#, expect![[r#" *Foo* @@ -1092,7 +1092,7 @@ fn hover_enum_limit() { #[test] fn hover_union_limit() { check_hover_adt_fields_or_variants_limit( - Some(10), + Some(5), r#"union Foo$0 { a: u32, b: i32 }"#, expect![[r#" *Foo* diff --git a/crates/ide/src/static_index.rs b/crates/ide/src/static_index.rs index 012778f058..1378ab2ab0 100644 --- a/crates/ide/src/static_index.rs +++ b/crates/ide/src/static_index.rs @@ -167,7 +167,7 @@ impl StaticIndex<'_> { keywords: true, format: crate::HoverDocFormat::Markdown, 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| { matches!( diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 0211fcfdf5..10bc19b988 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -313,7 +313,7 @@ config_data! { hover_memoryLayout_size: Option = Some(MemoryLayoutHoverRenderKindDef::Both), /// 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 = Some(10), + hover_show_adtFieldsOrVariants: Option = Some(5), /// How many associated items of a trait to display when hovering a trait. hover_show_traitAssocItems: Option = None, diff --git a/docs/user/generated_config.adoc b/docs/user/generated_config.adoc index 2df318f36d..d275b51abc 100644 --- a/docs/user/generated_config.adoc +++ b/docs/user/generated_config.adoc @@ -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. -- -[[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. diff --git a/editors/code/package.json b/editors/code/package.json index 504185fc22..88a382f1fb 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -1154,7 +1154,7 @@ }, "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.", - "default": 10, + "default": 5, "type": [ "null", "integer"