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