editor_settings.rs

  1use gpui::App;
  2use language::CursorShape;
  3use project::project_settings::DiagnosticSeverity;
  4use schemars::JsonSchema;
  5use serde::{Deserialize, Serialize};
  6use settings::{Settings, SettingsSources, VsCodeSettings};
  7use util::serde::default_true;
  8
  9/// Imports from the VSCode settings at
 10/// https://code.visualstudio.com/docs/reference/default-settings
 11#[derive(Deserialize, Clone)]
 12pub struct EditorSettings {
 13    pub cursor_blink: bool,
 14    pub cursor_shape: Option<CursorShape>,
 15    pub current_line_highlight: CurrentLineHighlight,
 16    pub selection_highlight: bool,
 17    pub lsp_highlight_debounce: u64,
 18    pub hover_popover_enabled: bool,
 19    pub hover_popover_delay: u64,
 20    pub toolbar: Toolbar,
 21    pub scrollbar: Scrollbar,
 22    pub minimap: Minimap,
 23    pub gutter: Gutter,
 24    pub scroll_beyond_last_line: ScrollBeyondLastLine,
 25    pub vertical_scroll_margin: f32,
 26    pub autoscroll_on_clicks: bool,
 27    pub horizontal_scroll_margin: f32,
 28    pub scroll_sensitivity: f32,
 29    pub relative_line_numbers: bool,
 30    pub seed_search_query_from_cursor: SeedQuerySetting,
 31    pub use_smartcase_search: bool,
 32    pub multi_cursor_modifier: MultiCursorModifier,
 33    pub redact_private_values: bool,
 34    pub expand_excerpt_lines: u32,
 35    pub middle_click_paste: bool,
 36    #[serde(default)]
 37    pub double_click_in_multibuffer: DoubleClickInMultibuffer,
 38    pub search_wrap: bool,
 39    #[serde(default)]
 40    pub search: SearchSettings,
 41    pub auto_signature_help: bool,
 42    pub show_signature_help_after_edits: bool,
 43    #[serde(default)]
 44    pub go_to_definition_fallback: GoToDefinitionFallback,
 45    pub jupyter: Jupyter,
 46    pub hide_mouse: Option<HideMouseMode>,
 47    pub snippet_sort_order: SnippetSortOrder,
 48    #[serde(default)]
 49    pub diagnostics_max_severity: Option<DiagnosticSeverity>,
 50}
 51
 52#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
 53#[serde(rename_all = "snake_case")]
 54pub enum CurrentLineHighlight {
 55    // Don't highlight the current line.
 56    None,
 57    // Highlight the gutter area.
 58    Gutter,
 59    // Highlight the editor area.
 60    Line,
 61    // Highlight the full line.
 62    All,
 63}
 64
 65/// When to populate a new search's query based on the text under the cursor.
 66#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
 67#[serde(rename_all = "snake_case")]
 68pub enum SeedQuerySetting {
 69    /// Always populate the search query with the word under the cursor.
 70    Always,
 71    /// Only populate the search query when there is text selected.
 72    Selection,
 73    /// Never populate the search query
 74    Never,
 75}
 76
 77/// What to do when multibuffer is double clicked in some of its excerpts (parts of singleton buffers).
 78#[derive(Default, Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
 79#[serde(rename_all = "snake_case")]
 80pub enum DoubleClickInMultibuffer {
 81    /// Behave as a regular buffer and select the whole word.
 82    #[default]
 83    Select,
 84    /// Open the excerpt clicked as a new buffer in the new tab, if no `alt` modifier was pressed during double click.
 85    /// Otherwise, behave as a regular buffer and select the whole word.
 86    Open,
 87}
 88
 89#[derive(Debug, Clone, Deserialize)]
 90pub struct Jupyter {
 91    /// Whether the Jupyter feature is enabled.
 92    ///
 93    /// Default: true
 94    pub enabled: bool,
 95}
 96
 97#[derive(Default, Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
 98#[serde(rename_all = "snake_case")]
 99pub struct JupyterContent {
100    /// Whether the Jupyter feature is enabled.
101    ///
102    /// Default: true
103    pub enabled: Option<bool>,
104}
105
106#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
107pub struct Toolbar {
108    pub breadcrumbs: bool,
109    pub quick_actions: bool,
110    pub selections_menu: bool,
111    pub agent_review: bool,
112}
113
114#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
115pub struct Scrollbar {
116    pub show: ShowScrollbar,
117    pub git_diff: bool,
118    pub selected_text: bool,
119    pub selected_symbol: bool,
120    pub search_results: bool,
121    pub diagnostics: ScrollbarDiagnostics,
122    pub cursors: bool,
123    pub axes: ScrollbarAxes,
124}
125
126#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq)]
127pub struct Minimap {
128    pub show: ShowMinimap,
129    pub thumb: MinimapThumb,
130    pub thumb_border: MinimapThumbBorder,
131    pub current_line_highlight: Option<CurrentLineHighlight>,
132}
133
134impl Minimap {
135    pub fn minimap_enabled(&self) -> bool {
136        self.show != ShowMinimap::Never
137    }
138
139    pub fn with_show_override(self) -> Self {
140        Self {
141            show: ShowMinimap::Always,
142            ..self
143        }
144    }
145}
146
147#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
148pub struct Gutter {
149    pub line_numbers: bool,
150    pub runnables: bool,
151    pub breakpoints: bool,
152    pub folds: bool,
153}
154
155/// When to show the scrollbar in the editor.
156///
157/// Default: auto
158#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
159#[serde(rename_all = "snake_case")]
160pub enum ShowScrollbar {
161    /// Show the scrollbar if there's important information or
162    /// follow the system's configured behavior.
163    Auto,
164    /// Match the system's configured behavior.
165    System,
166    /// Always show the scrollbar.
167    Always,
168    /// Never show the scrollbar.
169    Never,
170}
171
172/// When to show the minimap in the editor.
173///
174/// Default: never
175#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
176#[serde(rename_all = "snake_case")]
177pub enum ShowMinimap {
178    /// Follow the visibility of the scrollbar.
179    Auto,
180    /// Always show the minimap.
181    Always,
182    /// Never show the minimap.
183    #[default]
184    Never,
185}
186
187/// When to show the minimap thumb.
188///
189/// Default: always
190#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
191#[serde(rename_all = "snake_case")]
192pub enum MinimapThumb {
193    /// Show the minimap thumb only when the mouse is hovering over the minimap.
194    Hover,
195    /// Always show the minimap thumb.
196    #[default]
197    Always,
198}
199
200/// Defines the border style for the minimap's scrollbar thumb.
201///
202/// Default: left_open
203#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
204#[serde(rename_all = "snake_case")]
205pub enum MinimapThumbBorder {
206    /// Displays a border on all sides of the thumb.
207    Full,
208    /// Displays a border on all sides except the left side of the thumb.
209    #[default]
210    LeftOpen,
211    /// Displays a border on all sides except the right side of the thumb.
212    RightOpen,
213    /// Displays a border only on the left side of the thumb.
214    LeftOnly,
215    /// Displays the thumb without any border.
216    None,
217}
218
219/// Forcefully enable or disable the scrollbar for each axis
220#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
221#[serde(rename_all = "lowercase")]
222pub struct ScrollbarAxes {
223    /// When false, forcefully disables the horizontal scrollbar. Otherwise, obey other settings.
224    ///
225    /// Default: true
226    pub horizontal: bool,
227
228    /// When false, forcefully disables the vertical scrollbar. Otherwise, obey other settings.
229    ///
230    /// Default: true
231    pub vertical: bool,
232}
233
234/// Which diagnostic indicators to show in the scrollbar.
235///
236/// Default: all
237#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
238#[serde(rename_all = "lowercase")]
239pub enum ScrollbarDiagnostics {
240    /// Show all diagnostic levels: hint, information, warnings, error.
241    All,
242    /// Show only the following diagnostic levels: information, warning, error.
243    Information,
244    /// Show only the following diagnostic levels: warning, error.
245    Warning,
246    /// Show only the following diagnostic level: error.
247    Error,
248    /// Do not show diagnostics.
249    None,
250}
251
252/// The key to use for adding multiple cursors
253///
254/// Default: alt
255#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
256#[serde(rename_all = "snake_case")]
257pub enum MultiCursorModifier {
258    Alt,
259    #[serde(alias = "cmd", alias = "ctrl")]
260    CmdOrCtrl,
261}
262
263/// Whether the editor will scroll beyond the last line.
264///
265/// Default: one_page
266#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
267#[serde(rename_all = "snake_case")]
268pub enum ScrollBeyondLastLine {
269    /// The editor will not scroll beyond the last line.
270    Off,
271
272    /// The editor will scroll beyond the last line by one page.
273    OnePage,
274
275    /// The editor will scroll beyond the last line by the same number of lines as vertical_scroll_margin.
276    VerticalScrollMargin,
277}
278
279/// Default options for buffer and project search items.
280#[derive(Copy, Clone, Default, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
281pub struct SearchSettings {
282    /// Whether to show the project search button in the status bar.
283    #[serde(default = "default_true")]
284    pub button: bool,
285    #[serde(default)]
286    pub whole_word: bool,
287    #[serde(default)]
288    pub case_sensitive: bool,
289    #[serde(default)]
290    pub include_ignored: bool,
291    #[serde(default)]
292    pub regex: bool,
293}
294
295/// What to do when go to definition yields no results.
296#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
297#[serde(rename_all = "snake_case")]
298pub enum GoToDefinitionFallback {
299    /// Disables the fallback.
300    None,
301    /// Looks up references of the same symbol instead.
302    #[default]
303    FindAllReferences,
304}
305
306/// Determines when the mouse cursor should be hidden in an editor or input box.
307///
308/// Default: on_typing_and_movement
309#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
310#[serde(rename_all = "snake_case")]
311pub enum HideMouseMode {
312    /// Never hide the mouse cursor
313    Never,
314    /// Hide only when typing
315    OnTyping,
316    /// Hide on both typing and cursor movement
317    #[default]
318    OnTypingAndMovement,
319}
320
321/// Determines how snippets are sorted relative to other completion items.
322///
323/// Default: inline
324#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, PartialEq, Eq, JsonSchema)]
325#[serde(rename_all = "snake_case")]
326pub enum SnippetSortOrder {
327    /// Place snippets at the top of the completion list
328    Top,
329    /// Sort snippets normally using the default comparison logic
330    #[default]
331    Inline,
332    /// Place snippets at the bottom of the completion list
333    Bottom,
334}
335
336#[derive(Clone, Default, Serialize, Deserialize, JsonSchema)]
337#[schemars(deny_unknown_fields)]
338pub struct EditorSettingsContent {
339    /// Whether the cursor blinks in the editor.
340    ///
341    /// Default: true
342    pub cursor_blink: Option<bool>,
343    /// Cursor shape for the default editor.
344    /// Can be "bar", "block", "underline", or "hollow".
345    ///
346    /// Default: None
347    pub cursor_shape: Option<CursorShape>,
348    /// Determines when the mouse cursor should be hidden in an editor or input box.
349    ///
350    /// Default: on_typing_and_movement
351    pub hide_mouse: Option<HideMouseMode>,
352    /// Determines how snippets are sorted relative to other completion items.
353    ///
354    /// Default: inline
355    pub snippet_sort_order: Option<SnippetSortOrder>,
356    /// How to highlight the current line in the editor.
357    ///
358    /// Default: all
359    pub current_line_highlight: Option<CurrentLineHighlight>,
360    /// Whether to highlight all occurrences of the selected text in an editor.
361    ///
362    /// Default: true
363    pub selection_highlight: Option<bool>,
364    /// The debounce delay before querying highlights from the language
365    /// server based on the current cursor location.
366    ///
367    /// Default: 75
368    pub lsp_highlight_debounce: Option<u64>,
369    /// Whether to show the informational hover box when moving the mouse
370    /// over symbols in the editor.
371    ///
372    /// Default: true
373    pub hover_popover_enabled: Option<bool>,
374    /// Time to wait in milliseconds before showing the informational hover box.
375    ///
376    /// Default: 300
377    pub hover_popover_delay: Option<u64>,
378    /// Toolbar related settings
379    pub toolbar: Option<ToolbarContent>,
380    /// Scrollbar related settings
381    pub scrollbar: Option<ScrollbarContent>,
382    /// Minimap related settings
383    pub minimap: Option<MinimapContent>,
384    /// Gutter related settings
385    pub gutter: Option<GutterContent>,
386    /// Whether the editor will scroll beyond the last line.
387    ///
388    /// Default: one_page
389    pub scroll_beyond_last_line: Option<ScrollBeyondLastLine>,
390    /// The number of lines to keep above/below the cursor when auto-scrolling.
391    ///
392    /// Default: 3.
393    pub vertical_scroll_margin: Option<f32>,
394    /// Whether to scroll when clicking near the edge of the visible text area.
395    ///
396    /// Default: false
397    pub autoscroll_on_clicks: Option<bool>,
398    /// The number of characters to keep on either side when scrolling with the mouse.
399    ///
400    /// Default: 5.
401    pub horizontal_scroll_margin: Option<f32>,
402    /// Scroll sensitivity multiplier. This multiplier is applied
403    /// to both the horizontal and vertical delta values while scrolling.
404    ///
405    /// Default: 1.0
406    pub scroll_sensitivity: Option<f32>,
407    /// Whether the line numbers on editors gutter are relative or not.
408    ///
409    /// Default: false
410    pub relative_line_numbers: Option<bool>,
411    /// When to populate a new search's query based on the text under the cursor.
412    ///
413    /// Default: always
414    pub seed_search_query_from_cursor: Option<SeedQuerySetting>,
415    pub use_smartcase_search: Option<bool>,
416    /// The key to use for adding multiple cursors
417    ///
418    /// Default: alt
419    pub multi_cursor_modifier: Option<MultiCursorModifier>,
420    /// Hide the values of variables in `private` files, as defined by the
421    /// private_files setting. This only changes the visual representation,
422    /// the values are still present in the file and can be selected / copied / pasted
423    ///
424    /// Default: false
425    pub redact_private_values: Option<bool>,
426
427    /// How many lines to expand the multibuffer excerpts by default
428    ///
429    /// Default: 3
430    pub expand_excerpt_lines: Option<u32>,
431
432    /// Whether to enable middle-click paste on Linux
433    ///
434    /// Default: true
435    pub middle_click_paste: Option<bool>,
436
437    /// What to do when multibuffer is double clicked in some of its excerpts
438    /// (parts of singleton buffers).
439    ///
440    /// Default: select
441    pub double_click_in_multibuffer: Option<DoubleClickInMultibuffer>,
442    /// Whether the editor search results will loop
443    ///
444    /// Default: true
445    pub search_wrap: Option<bool>,
446
447    /// Defaults to use when opening a new buffer and project search items.
448    ///
449    /// Default: nothing is enabled
450    pub search: Option<SearchSettings>,
451
452    /// Whether to automatically show a signature help pop-up or not.
453    ///
454    /// Default: false
455    pub auto_signature_help: Option<bool>,
456
457    /// Whether to show the signature help pop-up after completions or bracket pairs inserted.
458    ///
459    /// Default: false
460    pub show_signature_help_after_edits: Option<bool>,
461
462    /// Whether to follow-up empty go to definition responses from the language server or not.
463    /// `FindAllReferences` allows to look up references of the same symbol instead.
464    /// `None` disables the fallback.
465    ///
466    /// Default: FindAllReferences
467    pub go_to_definition_fallback: Option<GoToDefinitionFallback>,
468
469    /// Jupyter REPL settings.
470    pub jupyter: Option<JupyterContent>,
471
472    /// Which level to use to filter out diagnostics displayed in the editor.
473    ///
474    /// Affects the editor rendering only, and does not interrupt
475    /// the functionality of diagnostics fetching and project diagnostics editor.
476    /// Which files containing diagnostic errors/warnings to mark in the tabs.
477    /// Diagnostics are only shown when file icons are also active.
478    ///
479    /// Shows all diagnostics if not specified.
480    ///
481    /// Default: warning
482    #[serde(default)]
483    pub diagnostics_max_severity: Option<DiagnosticSeverity>,
484}
485
486// Toolbar related settings
487#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
488pub struct ToolbarContent {
489    /// Whether to display breadcrumbs in the editor toolbar.
490    ///
491    /// Default: true
492    pub breadcrumbs: Option<bool>,
493    /// Whether to display quick action buttons in the editor toolbar.
494    ///
495    /// Default: true
496    pub quick_actions: Option<bool>,
497    /// Whether to show the selections menu in the editor toolbar.
498    ///
499    /// Default: true
500    pub selections_menu: Option<bool>,
501    /// Whether to display Agent review buttons in the editor toolbar.
502    /// Only applicable while reviewing a file edited by the Agent.
503    ///
504    /// Default: true
505    pub agent_review: Option<bool>,
506}
507
508/// Scrollbar related settings
509#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Default)]
510pub struct ScrollbarContent {
511    /// When to show the scrollbar in the editor.
512    ///
513    /// Default: auto
514    pub show: Option<ShowScrollbar>,
515    /// Whether to show git diff indicators in the scrollbar.
516    ///
517    /// Default: true
518    pub git_diff: Option<bool>,
519    /// Whether to show buffer search result indicators in the scrollbar.
520    ///
521    /// Default: true
522    pub search_results: Option<bool>,
523    /// Whether to show selected text occurrences in the scrollbar.
524    ///
525    /// Default: true
526    pub selected_text: Option<bool>,
527    /// Whether to show selected symbol occurrences in the scrollbar.
528    ///
529    /// Default: true
530    pub selected_symbol: Option<bool>,
531    /// Which diagnostic indicators to show in the scrollbar:
532    ///
533    /// Default: all
534    pub diagnostics: Option<ScrollbarDiagnostics>,
535    /// Whether to show cursor positions in the scrollbar.
536    ///
537    /// Default: true
538    pub cursors: Option<bool>,
539    /// Forcefully enable or disable the scrollbar for each axis
540    pub axes: Option<ScrollbarAxesContent>,
541}
542
543/// Minimap related settings
544#[derive(Copy, Clone, Default, Debug, Serialize, Deserialize, JsonSchema, PartialEq)]
545pub struct MinimapContent {
546    /// When to show the minimap in the editor.
547    ///
548    /// Default: never
549    pub show: Option<ShowMinimap>,
550
551    /// When to show the minimap thumb.
552    ///
553    /// Default: always
554    pub thumb: Option<MinimapThumb>,
555
556    /// Defines the border style for the minimap's scrollbar thumb.
557    ///
558    /// Default: left_open
559    pub thumb_border: Option<MinimapThumbBorder>,
560
561    /// How to highlight the current line in the minimap.
562    ///
563    /// Default: inherits editor line highlights setting
564    pub current_line_highlight: Option<Option<CurrentLineHighlight>>,
565}
566
567/// Forcefully enable or disable the scrollbar for each axis
568#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Default)]
569pub struct ScrollbarAxesContent {
570    /// When false, forcefully disables the horizontal scrollbar. Otherwise, obey other settings.
571    ///
572    /// Default: true
573    horizontal: Option<bool>,
574
575    /// When false, forcefully disables the vertical scrollbar. Otherwise, obey other settings.
576    ///
577    /// Default: true
578    vertical: Option<bool>,
579}
580
581/// Gutter related settings
582#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
583pub struct GutterContent {
584    /// Whether to show line numbers in the gutter.
585    ///
586    /// Default: true
587    pub line_numbers: Option<bool>,
588    /// Whether to show runnable buttons in the gutter.
589    ///
590    /// Default: true
591    pub runnables: Option<bool>,
592    /// Whether to show breakpoints in the gutter.
593    ///
594    /// Default: true
595    pub breakpoints: Option<bool>,
596    /// Whether to show fold buttons in the gutter.
597    ///
598    /// Default: true
599    pub folds: Option<bool>,
600}
601
602impl EditorSettings {
603    pub fn jupyter_enabled(cx: &App) -> bool {
604        EditorSettings::get_global(cx).jupyter.enabled
605    }
606}
607
608impl Settings for EditorSettings {
609    const KEY: Option<&'static str> = None;
610
611    type FileContent = EditorSettingsContent;
612
613    fn load(sources: SettingsSources<Self::FileContent>, _: &mut App) -> anyhow::Result<Self> {
614        sources.json_merge()
615    }
616
617    fn import_from_vscode(vscode: &VsCodeSettings, current: &mut Self::FileContent) {
618        vscode.enum_setting(
619            "editor.cursorBlinking",
620            &mut current.cursor_blink,
621            |s| match s {
622                "blink" | "phase" | "expand" | "smooth" => Some(true),
623                "solid" => Some(false),
624                _ => None,
625            },
626        );
627        vscode.enum_setting(
628            "editor.cursorStyle",
629            &mut current.cursor_shape,
630            |s| match s {
631                "block" => Some(CursorShape::Block),
632                "block-outline" => Some(CursorShape::Hollow),
633                "line" | "line-thin" => Some(CursorShape::Bar),
634                "underline" | "underline-thin" => Some(CursorShape::Underline),
635                _ => None,
636            },
637        );
638
639        vscode.enum_setting(
640            "editor.renderLineHighlight",
641            &mut current.current_line_highlight,
642            |s| match s {
643                "gutter" => Some(CurrentLineHighlight::Gutter),
644                "line" => Some(CurrentLineHighlight::Line),
645                "all" => Some(CurrentLineHighlight::All),
646                _ => None,
647            },
648        );
649
650        vscode.bool_setting(
651            "editor.selectionHighlight",
652            &mut current.selection_highlight,
653        );
654        vscode.bool_setting("editor.hover.enabled", &mut current.hover_popover_enabled);
655        vscode.u64_setting("editor.hover.delay", &mut current.hover_popover_delay);
656
657        let mut gutter = GutterContent::default();
658        vscode.enum_setting(
659            "editor.showFoldingControls",
660            &mut gutter.folds,
661            |s| match s {
662                "always" | "mouseover" => Some(true),
663                "never" => Some(false),
664                _ => None,
665            },
666        );
667        vscode.enum_setting(
668            "editor.lineNumbers",
669            &mut gutter.line_numbers,
670            |s| match s {
671                "on" | "relative" => Some(true),
672                "off" => Some(false),
673                _ => None,
674            },
675        );
676        if let Some(old_gutter) = current.gutter.as_mut() {
677            if gutter.folds.is_some() {
678                old_gutter.folds = gutter.folds
679            }
680            if gutter.line_numbers.is_some() {
681                old_gutter.line_numbers = gutter.line_numbers
682            }
683        } else {
684            if gutter != GutterContent::default() {
685                current.gutter = Some(gutter)
686            }
687        }
688        if let Some(b) = vscode.read_bool("editor.scrollBeyondLastLine") {
689            current.scroll_beyond_last_line = Some(if b {
690                ScrollBeyondLastLine::OnePage
691            } else {
692                ScrollBeyondLastLine::Off
693            })
694        }
695
696        let mut scrollbar_axes = ScrollbarAxesContent::default();
697        vscode.enum_setting(
698            "editor.scrollbar.horizontal",
699            &mut scrollbar_axes.horizontal,
700            |s| match s {
701                "auto" | "visible" => Some(true),
702                "hidden" => Some(false),
703                _ => None,
704            },
705        );
706        vscode.enum_setting(
707            "editor.scrollbar.vertical",
708            &mut scrollbar_axes.horizontal,
709            |s| match s {
710                "auto" | "visible" => Some(true),
711                "hidden" => Some(false),
712                _ => None,
713            },
714        );
715
716        if scrollbar_axes != ScrollbarAxesContent::default() {
717            let scrollbar_settings = current.scrollbar.get_or_insert_default();
718            let axes_settings = scrollbar_settings.axes.get_or_insert_default();
719
720            if let Some(vertical) = scrollbar_axes.vertical {
721                axes_settings.vertical = Some(vertical);
722            }
723            if let Some(horizontal) = scrollbar_axes.horizontal {
724                axes_settings.horizontal = Some(horizontal);
725            }
726        }
727
728        // TODO: check if this does the int->float conversion?
729        vscode.f32_setting(
730            "editor.cursorSurroundingLines",
731            &mut current.vertical_scroll_margin,
732        );
733        vscode.f32_setting(
734            "editor.mouseWheelScrollSensitivity",
735            &mut current.scroll_sensitivity,
736        );
737        if Some("relative") == vscode.read_string("editor.lineNumbers") {
738            current.relative_line_numbers = Some(true);
739        }
740
741        vscode.enum_setting(
742            "editor.find.seedSearchStringFromSelection",
743            &mut current.seed_search_query_from_cursor,
744            |s| match s {
745                "always" => Some(SeedQuerySetting::Always),
746                "selection" => Some(SeedQuerySetting::Selection),
747                "never" => Some(SeedQuerySetting::Never),
748                _ => None,
749            },
750        );
751        vscode.bool_setting("search.smartCase", &mut current.use_smartcase_search);
752        vscode.enum_setting(
753            "editor.multiCursorModifier",
754            &mut current.multi_cursor_modifier,
755            |s| match s {
756                "ctrlCmd" => Some(MultiCursorModifier::CmdOrCtrl),
757                "alt" => Some(MultiCursorModifier::Alt),
758                _ => None,
759            },
760        );
761
762        vscode.bool_setting(
763            "editor.parameterHints.enabled",
764            &mut current.auto_signature_help,
765        );
766        vscode.bool_setting(
767            "editor.parameterHints.enabled",
768            &mut current.show_signature_help_after_edits,
769        );
770
771        if let Some(use_ignored) = vscode.read_bool("search.useIgnoreFiles") {
772            let search = current.search.get_or_insert_default();
773            search.include_ignored = use_ignored;
774        }
775
776        let mut minimap = MinimapContent::default();
777        let minimap_enabled = vscode.read_bool("editor.minimap.enabled").unwrap_or(true);
778        let autohide = vscode.read_bool("editor.minimap.autohide");
779        if minimap_enabled {
780            if let Some(false) = autohide {
781                minimap.show = Some(ShowMinimap::Always);
782            } else {
783                minimap.show = Some(ShowMinimap::Auto);
784            }
785        } else {
786            minimap.show = Some(ShowMinimap::Never);
787        }
788
789        vscode.enum_setting(
790            "editor.minimap.showSlider",
791            &mut minimap.thumb,
792            |s| match s {
793                "always" => Some(MinimapThumb::Always),
794                "mouseover" => Some(MinimapThumb::Hover),
795                _ => None,
796            },
797        );
798
799        if minimap != MinimapContent::default() {
800            current.minimap = Some(minimap)
801        }
802    }
803}