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