settings_ui: Organize page data (#46275)

Closes #ISSUE

Organizes the giant list of settings UI items in `page_data.rs` a bit so
that sections are split out in sub functions that (for the most part)
return constant size arrays. Page items is also converted to a
`Box<[...]>` instead of a Vec.

The goal here is to have working breadcrumbs when in the settings UI
file (e.g. `fn general_page() > fn general_section()`), and to escape
the `vec![]` macro so that `rust-analyzer` works more consistently.

This should help both humans and LLMs know where they are in the file
and use the outline to navigate it instead of having to read the whole
thing to have an idea of what is going on.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Ben Kunkle authored and GitHub committed 2026-01-07 16:14:00 -05:00
1 parent e61f31ee4a
commit f367b7cdd2
3 files changed
+7866 -7107

No files matched your search

File diff suppressed because it is too large. Load diff
+18 -6
View File
@@ -727,7 +727,7 @@ struct NavBarEntry {
struct SettingsPage {
title: &'static str,
items: Vec<SettingsPageItem>,
items: Box<[SettingsPageItem]>,
}
#[derive(PartialEq)]
@@ -3965,7 +3965,11 @@ pub mod test {
}
fn parse(input: &'static str, window: &mut Window, cx: &mut App) -> SettingsWindow {
let mut pages: Vec<SettingsPage> = Vec::new();
struct PageBuilder {
title: &'static str,
items: Vec<SettingsPageItem>,
}
let mut page_builders: Vec<PageBuilder> = Vec::new();
let mut expanded_pages = Vec::new();
let mut selected_idx = None;
let mut index = 0;
@@ -3985,23 +3989,23 @@ pub mod test {
assert_eq!(kind.len(), 1);
let kind = kind.chars().next().unwrap();
if kind == 'v' {
let page_idx = pages.len();
let page_idx = page_builders.len();
expanded_pages.push(page_idx);
pages.push(SettingsPage {
page_builders.push(PageBuilder {
title,
items: vec![],
});
index += 1;
in_expanded_section = true;
} else if kind == '>' {
pages.push(SettingsPage {
page_builders.push(PageBuilder {
title,
items: vec![],
});
index += 1;
in_expanded_section = false;
} else if kind == '-' {
pages
page_builders
.last_mut()
.unwrap()
.items
@@ -4018,6 +4022,14 @@ pub mod test {
}
}
let pages: Vec<SettingsPage> = page_builders
.into_iter()
.map(|builder| SettingsPage {
title: builder.title,
items: builder.items.into_boxed_slice(),
})
.collect();
let mut settings_window = SettingsWindow {
title_bar: None,
original_window: None,
Binary file not shown.