settings ui: Add missing setting elements (#39644)
Added the following settings to the UI Editor Page - Scrollbar Section (9 settings) - Show - Cursors - Git Diff - Search Results - Selected Text - Selected Symbol - Diagnostics - Horizontal Scrollbar - Vertical Scrollbar Editor Page - Minimap Section (6 settings) - Show - Display In - Thumb - Thumb Border - Current Line Highlight - Max Width Columns Editor Page - Editor Behavior Section (3 settings) - Expand Excerpt Lines - Excerpt Context Lines - Minimum Contrast For Highlights Debugger Page (7 settings) - Stepping Granularity - Save Breakpoints - Timeout - Dock - Log DAP Communications - Format DAP Log Messages - Button Panels Page - Git Panel Section (3 settings) - Button - Dock - Default Width Collaboration Page - Experimental Section (4 settings) - Auto Microphone Volume - Auto Speaker Volume - Denoise - Legacy Audio Compatible Release Notes: - N/A
This commit is contained in:
@@ -383,7 +383,18 @@ pub struct DebuggerSettingsContent {
|
||||
|
||||
/// The granularity of one 'step' in the stepping requests `next`, `stepIn`, `stepOut`, and `stepBack`.
|
||||
#[derive(
|
||||
PartialEq, Eq, Debug, Hash, Clone, Copy, Deserialize, Serialize, JsonSchema, MergeFrom,
|
||||
PartialEq,
|
||||
Eq,
|
||||
Debug,
|
||||
Hash,
|
||||
Clone,
|
||||
Copy,
|
||||
Deserialize,
|
||||
Serialize,
|
||||
JsonSchema,
|
||||
MergeFrom,
|
||||
strum::VariantArray,
|
||||
strum::VariantNames,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum SteppingGranularity {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use std::fmt::Display;
|
||||
use std::num;
|
||||
|
||||
use collections::HashMap;
|
||||
@@ -153,7 +154,8 @@ pub struct EditorSettingsContent {
|
||||
///
|
||||
/// Values range from 0 to 106. Set to 0 to disable adjustments.
|
||||
/// Default: 45
|
||||
pub minimum_contrast_for_highlights: Option<f32>,
|
||||
#[schemars(range(min = 0, max = 106))]
|
||||
pub minimum_contrast_for_highlights: Option<MinimumContrast>,
|
||||
|
||||
/// Whether to follow-up empty go to definition responses from the language server or not.
|
||||
/// `FindAllReferences` allows to look up references of the same symbol instead.
|
||||
@@ -425,7 +427,18 @@ pub enum DoubleClickInMultibuffer {
|
||||
///
|
||||
/// Default: always
|
||||
#[derive(
|
||||
Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq,
|
||||
Copy,
|
||||
Clone,
|
||||
Debug,
|
||||
Default,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
JsonSchema,
|
||||
MergeFrom,
|
||||
PartialEq,
|
||||
Eq,
|
||||
strum::VariantArray,
|
||||
strum::VariantNames,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum MinimapThumb {
|
||||
@@ -440,7 +453,18 @@ pub enum MinimapThumb {
|
||||
///
|
||||
/// Default: left_open
|
||||
#[derive(
|
||||
Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq,
|
||||
Copy,
|
||||
Clone,
|
||||
Debug,
|
||||
Default,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
JsonSchema,
|
||||
MergeFrom,
|
||||
PartialEq,
|
||||
Eq,
|
||||
strum::VariantArray,
|
||||
strum::VariantNames,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum MinimapThumbBorder {
|
||||
@@ -460,7 +484,19 @@ pub enum MinimapThumbBorder {
|
||||
/// Which diagnostic indicators to show in the scrollbar.
|
||||
///
|
||||
/// Default: all
|
||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq)]
|
||||
#[derive(
|
||||
Copy,
|
||||
Clone,
|
||||
Debug,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
JsonSchema,
|
||||
MergeFrom,
|
||||
PartialEq,
|
||||
Eq,
|
||||
strum::VariantArray,
|
||||
strum::VariantNames,
|
||||
)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum ScrollbarDiagnostics {
|
||||
/// Show all diagnostic levels: hint, information, warnings, error.
|
||||
@@ -682,7 +718,18 @@ pub struct DragAndDropSelectionContent {
|
||||
///
|
||||
/// Default: never
|
||||
#[derive(
|
||||
Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq,
|
||||
Copy,
|
||||
Clone,
|
||||
Debug,
|
||||
Default,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
JsonSchema,
|
||||
MergeFrom,
|
||||
PartialEq,
|
||||
Eq,
|
||||
strum::VariantArray,
|
||||
strum::VariantNames,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ShowMinimap {
|
||||
@@ -699,7 +746,18 @@ pub enum ShowMinimap {
|
||||
///
|
||||
/// Default: all_editors
|
||||
#[derive(
|
||||
Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq,
|
||||
Copy,
|
||||
Clone,
|
||||
Debug,
|
||||
Default,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
JsonSchema,
|
||||
MergeFrom,
|
||||
PartialEq,
|
||||
Eq,
|
||||
strum::VariantArray,
|
||||
strum::VariantNames,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum DisplayIn {
|
||||
@@ -709,3 +767,28 @@ pub enum DisplayIn {
|
||||
#[default]
|
||||
ActiveEditor,
|
||||
}
|
||||
|
||||
/// Minimum APCA perceptual contrast for text over highlight backgrounds.
|
||||
///
|
||||
/// Valid range: 0.0 to 106.0
|
||||
/// Default: 45.0
|
||||
#[derive(
|
||||
Clone,
|
||||
Copy,
|
||||
Debug,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
JsonSchema,
|
||||
MergeFrom,
|
||||
PartialEq,
|
||||
PartialOrd,
|
||||
derive_more::FromStr,
|
||||
)]
|
||||
#[serde(transparent)]
|
||||
pub struct MinimumContrast(pub f32);
|
||||
|
||||
impl Display for MinimumContrast {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{:.1}", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ pub struct GitSettings {
|
||||
pub git_gutter: Option<GitGutterSetting>,
|
||||
/// Sets the debounce threshold (in milliseconds) after which changes are reflected in the git gutter.
|
||||
///
|
||||
/// Default: null
|
||||
/// Default: 0
|
||||
pub gutter_debounce: Option<u64>,
|
||||
/// Whether or not to show git blame data inline in
|
||||
/// the currently focused line.
|
||||
|
||||
@@ -199,7 +199,19 @@ impl TerminalLineHeight {
|
||||
/// When to show the scrollbar.
|
||||
///
|
||||
/// Default: auto
|
||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq)]
|
||||
#[derive(
|
||||
Copy,
|
||||
Clone,
|
||||
Debug,
|
||||
Serialize,
|
||||
Deserialize,
|
||||
JsonSchema,
|
||||
MergeFrom,
|
||||
PartialEq,
|
||||
Eq,
|
||||
strum::VariantArray,
|
||||
strum::VariantNames,
|
||||
)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ShowScrollbar {
|
||||
/// Show the scrollbar if there's important information or
|
||||
|
||||
@@ -538,6 +538,7 @@ impl SettingsStore {
|
||||
&self,
|
||||
target_file: SettingsFile,
|
||||
pick: fn(&SettingsContent) -> &Option<T>,
|
||||
type_name: &'static str,
|
||||
) -> (SettingsFile, &T) {
|
||||
// TODO: Add a metadata field for overriding the "overrides" tag, for contextually different settings
|
||||
// e.g. disable AI isn't overridden, or a vec that gets extended instead or some such
|
||||
@@ -568,7 +569,7 @@ impl SettingsStore {
|
||||
}
|
||||
}
|
||||
|
||||
unreachable!("All values should have defaults");
|
||||
unreachable!("{type_name}: doesn't have a default value");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1714,16 +1715,24 @@ mod tests {
|
||||
let default_value = get(&store.default_settings).unwrap();
|
||||
|
||||
assert_eq!(
|
||||
store.get_value_from_file(SettingsFile::Local(local.clone()), get),
|
||||
store.get_value_from_file(
|
||||
SettingsFile::Local(local.clone()),
|
||||
get,
|
||||
"preferred line length"
|
||||
),
|
||||
(SettingsFile::User, &0)
|
||||
);
|
||||
assert_eq!(
|
||||
store.get_value_from_file(SettingsFile::User, get),
|
||||
store.get_value_from_file(SettingsFile::User, get, "preferred line length"),
|
||||
(SettingsFile::User, &0)
|
||||
);
|
||||
store.set_user_settings(r#"{}"#, cx).unwrap();
|
||||
assert_eq!(
|
||||
store.get_value_from_file(SettingsFile::Local(local.clone()), get),
|
||||
store.get_value_from_file(
|
||||
SettingsFile::Local(local.clone()),
|
||||
get,
|
||||
"preferred line length"
|
||||
),
|
||||
(SettingsFile::Default, &default_value)
|
||||
);
|
||||
store
|
||||
@@ -1736,11 +1745,15 @@ mod tests {
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
store.get_value_from_file(SettingsFile::Local(local.clone()), get),
|
||||
store.get_value_from_file(
|
||||
SettingsFile::Local(local.clone()),
|
||||
get,
|
||||
"preferred line length"
|
||||
),
|
||||
(SettingsFile::Local(local), &80)
|
||||
);
|
||||
assert_eq!(
|
||||
store.get_value_from_file(SettingsFile::User, get),
|
||||
store.get_value_from_file(SettingsFile::User, get, "preferred line length"),
|
||||
(SettingsFile::Default, &default_value)
|
||||
);
|
||||
}
|
||||
@@ -1817,11 +1830,19 @@ mod tests {
|
||||
|
||||
// each local child should only inherit from it's parent
|
||||
assert_eq!(
|
||||
store.get_value_from_file(SettingsFile::Local(local_2_child), get),
|
||||
store.get_value_from_file(
|
||||
SettingsFile::Local(local_2_child),
|
||||
get,
|
||||
"preferred_line_length"
|
||||
),
|
||||
(SettingsFile::Local(local_2), &2)
|
||||
);
|
||||
assert_eq!(
|
||||
store.get_value_from_file(SettingsFile::Local(local_1_child.clone()), get),
|
||||
store.get_value_from_file(
|
||||
SettingsFile::Local(local_1_child.clone()),
|
||||
get,
|
||||
"preferred_line_length"
|
||||
),
|
||||
(SettingsFile::Local(local_1.clone()), &1)
|
||||
);
|
||||
|
||||
@@ -1847,7 +1868,11 @@ mod tests {
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(
|
||||
store.get_value_from_file(SettingsFile::Local(local_1_adjacent_child.clone()), get),
|
||||
store.get_value_from_file(
|
||||
SettingsFile::Local(local_1_adjacent_child.clone()),
|
||||
get,
|
||||
"preferred_line_length"
|
||||
),
|
||||
(SettingsFile::Local(local_1.clone()), &1)
|
||||
);
|
||||
store
|
||||
@@ -1869,7 +1894,11 @@ mod tests {
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
store.get_value_from_file(SettingsFile::Local(local_1_child), get),
|
||||
store.get_value_from_file(
|
||||
SettingsFile::Local(local_1_child),
|
||||
get,
|
||||
"preferred_line_length"
|
||||
),
|
||||
(SettingsFile::Local(local_1), &1)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user