From e0be75830834981d1b6df55a70d28c4916b2a97d Mon Sep 17 00:00:00 2001 From: Anthony Date: Thu, 9 Oct 2025 12:29:21 -0400 Subject: [PATCH] Fix some settings ui elements having duplicate ids --- crates/settings_ui/src/page_data.rs | 2 +- crates/settings_ui/src/settings_ui.rs | 17 ++++++----------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/crates/settings_ui/src/page_data.rs b/crates/settings_ui/src/page_data.rs index 2e533806028e6f4806e817f603039ab1fe6c5f94..8fb71367a70ae05eae6701b2b86ac4645f8ba00d 100644 --- a/crates/settings_ui/src/page_data.rs +++ b/crates/settings_ui/src/page_data.rs @@ -5278,7 +5278,7 @@ fn language_settings_data() -> Vec { files: USER | LOCAL, }), SettingsPageItem::SettingItem(SettingItem { - title: "Lsp", + title: "LSP", description: "Whether to fetch LSP completions or not", field: Box::new(SettingField { pick: |settings_content| { diff --git a/crates/settings_ui/src/settings_ui.rs b/crates/settings_ui/src/settings_ui.rs index 527c05f568497eb9dfb2c81b8e61708e2dbfb12d..922f66d2df2b013ec338ca69e1acca81f4ee6ef8 100644 --- a/crates/settings_ui/src/settings_ui.rs +++ b/crates/settings_ui/src/settings_ui.rs @@ -461,14 +461,6 @@ fn init_renderers(cx: &mut App) { render_dropdown(*settings_field, file, window, cx) }) .add_renderer::(|settings_field, file, _, window, cx| { - let variants = || -> &'static [settings::ShowMinimap] { - ::VARIANTS - }; - let labels = || -> &'static [&'static str] { - ::VARIANTS - }; - dbg!(variants(), labels()); - render_dropdown(*settings_field, file, window, cx) }) .add_renderer::(|settings_field, file, _, window, cx| { @@ -630,6 +622,7 @@ impl SettingsPageItem { &self, settings_window: &SettingsWindow, section_header: &'static str, + item_index: usize, is_last: bool, window: &mut Window, cx: &mut Context, @@ -653,7 +646,7 @@ impl SettingsPageItem { let file_set_in = SettingsUiFile::from_settings(found_in_file); h_flex() - .id(setting_item.title) + .id((setting_item.title, item_index)) .min_w_0() .gap_2() .justify_between() @@ -722,7 +715,7 @@ impl SettingsPageItem { .into_any_element() } SettingsPageItem::SubPageLink(sub_page_link) => h_flex() - .id(sub_page_link.title) + .id((sub_page_link.title, item_index)) .w_full() .min_w_0() .gap_2() @@ -1755,6 +1748,7 @@ impl SettingsWindow { .child(item.render( self, section_header.expect("All items rendered after a section header"), + index, no_bottom_border || is_last, window, cx, @@ -2178,6 +2172,7 @@ fn render_toggle_button + From + Copy>( .on_click({ move |state, _window, cx| { let state = *state == ui::ToggleState::Selected; + dbg!(state); update_settings_file(file.clone(), cx, move |settings, _cx| { *(field.pick_mut)(settings) = Some(state.into()); }) @@ -2277,7 +2272,7 @@ where labels()[variants().iter().position(|v| *v == current_value).unwrap()]; DropdownMenu::new( - SharedString::from(format!("dropdown-{}", field.type_name())), + "dropdown", current_value_label.to_title_case(), ContextMenu::build(window, cx, move |mut menu, _, _| { for (&value, &label) in std::iter::zip(variants(), labels()) {