Skip to content

Commit

Permalink
fix: adjust the limitation for ADTs' fields to 5
Browse files Browse the repository at this point in the history
  • Loading branch information
roife committed Apr 7, 2024
1 parent 0ec41cd commit edac1b5
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions crates/ide/src/hover/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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*
Expand Down Expand Up @@ -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*
Expand Down
2 changes: 1 addition & 1 deletion crates/ide/src/static_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
2 changes: 1 addition & 1 deletion crates/rust-analyzer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ config_data! {
hover_memoryLayout_size: Option<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<usize> = "10",
hover_show_adtFieldsOrVariants: Option<usize> = "5",
/// How many associated items of a trait to display when hovering a trait.
hover_show_traitAssocItems: Option<usize> = "null",

Expand Down
2 changes: 1 addition & 1 deletion docs/user/generated_config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,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.
Expand Down
2 changes: 1 addition & 1 deletion editors/code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit edac1b5

Please sign in to comment.