mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-07 20:39:04 +03:00
Use more convntional name for the settings
This commit is contained in:
parent
706f6f495a
commit
075bab2ea9
@ -42,7 +42,7 @@
|
|||||||
// "none"
|
// "none"
|
||||||
// 3. Draw all invisible symbols:
|
// 3. Draw all invisible symbols:
|
||||||
// "all"
|
// "all"
|
||||||
"show_invisibles": "selection",
|
"show_whitespaces": "selection",
|
||||||
// Whether the screen sharing icon is shown in the os status bar.
|
// Whether the screen sharing icon is shown in the os status bar.
|
||||||
"show_call_status_icon": true,
|
"show_call_status_icon": true,
|
||||||
// Whether to use language servers to provide code intelligence.
|
// Whether to use language servers to provide code intelligence.
|
||||||
|
@ -37,7 +37,7 @@ use itertools::Itertools;
|
|||||||
use json::json;
|
use json::json;
|
||||||
use language::{Bias, CursorShape, DiagnosticSeverity, OffsetUtf16, Selection};
|
use language::{Bias, CursorShape, DiagnosticSeverity, OffsetUtf16, Selection};
|
||||||
use project::ProjectPath;
|
use project::ProjectPath;
|
||||||
use settings::{GitGutter, Settings, ShowInvisibles};
|
use settings::{GitGutter, Settings, ShowWhitespaces};
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use std::{
|
use std::{
|
||||||
borrow::Cow,
|
borrow::Cow,
|
||||||
@ -1657,13 +1657,13 @@ fn draw_invisibles(
|
|||||||
let settings = cx.global::<Settings>();
|
let settings = cx.global::<Settings>();
|
||||||
let regions_to_hit = match settings
|
let regions_to_hit = match settings
|
||||||
.editor_overrides
|
.editor_overrides
|
||||||
.show_invisibles
|
.show_whitespaces
|
||||||
.or(settings.editor_defaults.show_invisibles)
|
.or(settings.editor_defaults.show_whitespaces)
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
{
|
{
|
||||||
ShowInvisibles::None => return,
|
ShowWhitespaces::None => return,
|
||||||
ShowInvisibles::Selection => Some(selection_ranges),
|
ShowWhitespaces::Selection => Some(selection_ranges),
|
||||||
ShowInvisibles::All => None,
|
ShowWhitespaces::All => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
for invisible in &line_with_invisibles.invisibles {
|
for invisible in &line_with_invisibles.invisibles {
|
||||||
@ -2895,7 +2895,7 @@ mod tests {
|
|||||||
|
|
||||||
cx.update(|cx| {
|
cx.update(|cx| {
|
||||||
let mut test_settings = Settings::test(cx);
|
let mut test_settings = Settings::test(cx);
|
||||||
test_settings.editor_defaults.show_invisibles = Some(ShowInvisibles::All);
|
test_settings.editor_defaults.show_whitespaces = Some(ShowWhitespaces::All);
|
||||||
test_settings.editor_defaults.tab_size = Some(NonZeroU32::new(tab_size).unwrap());
|
test_settings.editor_defaults.tab_size = Some(NonZeroU32::new(tab_size).unwrap());
|
||||||
cx.set_global(test_settings);
|
cx.set_global(test_settings);
|
||||||
});
|
});
|
||||||
|
@ -173,7 +173,7 @@ pub struct EditorSettings {
|
|||||||
pub formatter: Option<Formatter>,
|
pub formatter: Option<Formatter>,
|
||||||
pub enable_language_server: Option<bool>,
|
pub enable_language_server: Option<bool>,
|
||||||
pub show_copilot_suggestions: Option<bool>,
|
pub show_copilot_suggestions: Option<bool>,
|
||||||
pub show_invisibles: Option<ShowInvisibles>,
|
pub show_whitespaces: Option<ShowWhitespaces>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
|
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
|
||||||
@ -449,7 +449,7 @@ pub struct FeaturesContent {
|
|||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
|
#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum ShowInvisibles {
|
pub enum ShowWhitespaces {
|
||||||
#[default]
|
#[default]
|
||||||
Selection,
|
Selection,
|
||||||
None,
|
None,
|
||||||
@ -517,7 +517,7 @@ impl Settings {
|
|||||||
formatter: required(defaults.editor.formatter),
|
formatter: required(defaults.editor.formatter),
|
||||||
enable_language_server: required(defaults.editor.enable_language_server),
|
enable_language_server: required(defaults.editor.enable_language_server),
|
||||||
show_copilot_suggestions: required(defaults.editor.show_copilot_suggestions),
|
show_copilot_suggestions: required(defaults.editor.show_copilot_suggestions),
|
||||||
show_invisibles: required(defaults.editor.show_invisibles),
|
show_whitespaces: required(defaults.editor.show_whitespaces),
|
||||||
},
|
},
|
||||||
editor_overrides: Default::default(),
|
editor_overrides: Default::default(),
|
||||||
copilot: CopilotSettings {
|
copilot: CopilotSettings {
|
||||||
@ -668,8 +668,8 @@ impl Settings {
|
|||||||
self.language_setting(language, |settings| settings.tab_size)
|
self.language_setting(language, |settings| settings.tab_size)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn show_invisibles(&self, language: Option<&str>) -> ShowInvisibles {
|
pub fn show_whitespaces(&self, language: Option<&str>) -> ShowWhitespaces {
|
||||||
self.language_setting(language, |settings| settings.show_invisibles)
|
self.language_setting(language, |settings| settings.show_whitespaces)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hard_tabs(&self, language: Option<&str>) -> bool {
|
pub fn hard_tabs(&self, language: Option<&str>) -> bool {
|
||||||
@ -808,7 +808,7 @@ impl Settings {
|
|||||||
formatter: Some(Formatter::LanguageServer),
|
formatter: Some(Formatter::LanguageServer),
|
||||||
enable_language_server: Some(true),
|
enable_language_server: Some(true),
|
||||||
show_copilot_suggestions: Some(true),
|
show_copilot_suggestions: Some(true),
|
||||||
show_invisibles: Some(ShowInvisibles::None),
|
show_whitespaces: Some(ShowWhitespaces::None),
|
||||||
},
|
},
|
||||||
editor_overrides: Default::default(),
|
editor_overrides: Default::default(),
|
||||||
copilot: Default::default(),
|
copilot: Default::default(),
|
||||||
|
Loading…
Reference in New Issue
Block a user