settings_ui: Get editor settings working (#37330)

Closes #ISSUE

This PR includes the necessary work to get `EditorSettings` showing up
in the settings UI. Including making the `path` field on
`SettingsUiItem`'s optional so that top level items such as
`EditorSettings` which have `Settings::KEY = None` (i.e. are treated
like `serde(flatten)`) have their paths computed correctly for JSON
reading/updating.

It includes the first examples of a pattern I expect to continue with
the `SettingsUi` work with respect to settings reorganization, that
being adding missing defaults, and adding explicit values (or aliases)
to settings which previously relied on `null` being a value for optional
fields.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Ben Kunkle
2025-09-02 00:26:42 +00:00
committed by GitHub
parent 60d17cccd3
commit 54cec5b484
9 changed files with 246 additions and 152 deletions
+4 -2
View File
@@ -32,7 +32,7 @@ use parking_lot::Mutex;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use settings::WorktreeId;
use settings::{SettingsUi, WorktreeId};
use smallvec::SmallVec;
use smol::future::yield_now;
use std::{
@@ -173,7 +173,9 @@ pub enum IndentKind {
}
/// The shape of a selection cursor.
#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
#[derive(
Copy, Clone, Debug, Default, Serialize, Deserialize, PartialEq, Eq, JsonSchema, SettingsUi,
)]
#[serde(rename_all = "snake_case")]
pub enum CursorShape {
/// A vertical bar