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