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)]
335#[schemars(deny_unknown_fields)]
336pub struct EditorSettingsContent {
337    /// Whether the cursor blinks in the editor.
338    ///
339    /// Default: true
340    pub cursor_blink: Option<bool>,
341    /// Cursor shape for the default editor.
342    /// Can be "bar", "block", "underline", or "hollow".
343    ///
344    /// Default: None
345    pub cursor_shape: Option<CursorShape>,
346    /// Determines when the mouse cursor should be hidden in an editor or input box.
347    ///
348    /// Default: on_typing_and_movement
349    pub hide_mouse: Option<HideMouseMode>,
350    /// Determines how snippets are sorted relative to other completion items.
351    ///
352    /// Default: inline
353    pub snippet_sort_order: Option<SnippetSortOrder>,
354    /// How to highlight the current line in the editor.
355    ///
356    /// Default: all
357    pub current_line_highlight: Option<CurrentLineHighlight>,
358    /// Whether to highlight all occurrences of the selected text in an editor.
359    ///
360    /// Default: true
361    pub selection_highlight: Option<bool>,
362    /// The debounce delay before querying highlights from the language
363    /// server based on the current cursor location.
364    ///
365    /// Default: 75
366    pub lsp_highlight_debounce: Option<u64>,
367    /// Whether to show the informational hover box when moving the mouse
368    /// over symbols in the editor.
369    ///
370    /// Default: true
371    pub hover_popover_enabled: Option<bool>,
372    /// Time to wait in milliseconds before showing the informational hover box.
373    ///
374    /// Default: 300
375    pub hover_popover_delay: Option<u64>,
376    /// Toolbar related settings
377    pub toolbar: Option<ToolbarContent>,
378    /// Scrollbar related settings
379    pub scrollbar: Option<ScrollbarContent>,
380    /// Minimap related settings
381    pub minimap: Option<MinimapContent>,
382    /// Gutter related settings
383    pub gutter: Option<GutterContent>,
384    /// Whether the editor will scroll beyond the last line.
385    ///
386    /// Default: one_page
387    pub scroll_beyond_last_line: Option<ScrollBeyondLastLine>,
388    /// The number of lines to keep above/below the cursor when auto-scrolling.
389    ///
390    /// Default: 3.
391    pub vertical_scroll_margin: Option<f32>,
392    /// Whether to scroll when clicking near the edge of the visible text area.
393    ///
394    /// Default: false
395    pub autoscroll_on_clicks: Option<bool>,
396    /// The number of characters to keep on either side when scrolling with the mouse.
397    ///
398    /// Default: 5.
399    pub horizontal_scroll_margin: Option<f32>,
400    /// Scroll sensitivity multiplier. This multiplier is applied
401    /// to both the horizontal and vertical delta values while scrolling.
402    ///
403    /// Default: 1.0
404    pub scroll_sensitivity: Option<f32>,
405    /// Whether the line numbers on editors gutter are relative or not.
406    ///
407    /// Default: false
408    pub relative_line_numbers: Option<bool>,
409    /// When to populate a new search's query based on the text under the cursor.
410    ///
411    /// Default: always
412    pub seed_search_query_from_cursor: Option<SeedQuerySetting>,
413    pub use_smartcase_search: Option<bool>,
414    /// The key to use for adding multiple cursors
415    ///
416    /// Default: alt
417    pub multi_cursor_modifier: Option<MultiCursorModifier>,
418    /// Hide the values of variables in `private` files, as defined by the
419    /// private_files setting. This only changes the visual representation,
420    /// the values are still present in the file and can be selected / copied / pasted
421    ///
422    /// Default: false
423    pub redact_private_values: Option<bool>,
424
425    /// How many lines to expand the multibuffer excerpts by default
426    ///
427    /// Default: 3
428    pub expand_excerpt_lines: Option<u32>,
429
430    /// Whether to enable middle-click paste on Linux
431    ///
432    /// Default: true
433    pub middle_click_paste: Option<bool>,
434
435    /// What to do when multibuffer is double clicked in some of its excerpts
436    /// (parts of singleton buffers).
437    ///
438    /// Default: select
439    pub double_click_in_multibuffer: Option<DoubleClickInMultibuffer>,
440    /// Whether the editor search results will loop
441    ///
442    /// Default: true
443    pub search_wrap: Option<bool>,
444
445    /// Defaults to use when opening a new buffer and project search items.
446    ///
447    /// Default: nothing is enabled
448    pub search: Option<SearchSettings>,
449
450    /// Whether to automatically show a signature help pop-up or not.
451    ///
452    /// Default: false
453    pub auto_signature_help: Option<bool>,
454
455    /// Whether to show the signature help pop-up after completions or bracket pairs inserted.
456    ///
457    /// Default: false
458    pub show_signature_help_after_edits: Option<bool>,
459
460    /// Whether to follow-up empty go to definition responses from the language server or not.
461    /// `FindAllReferences` allows to look up references of the same symbol instead.
462    /// `None` disables the fallback.
463    ///
464    /// Default: FindAllReferences
465    pub go_to_definition_fallback: Option<GoToDefinitionFallback>,
466
467    /// Jupyter REPL settings.
468    pub jupyter: Option<JupyterContent>,
469
470    /// Which level to use to filter out diagnostics displayed in the editor.
471    ///
472    /// Affects the editor rendering only, and does not interrupt
473    /// the functionality of diagnostics fetching and project diagnostics editor.
474    /// Which files containing diagnostic errors/warnings to mark in the tabs.
475    /// Diagnostics are only shown when file icons are also active.
476    ///
477    /// Shows all diagnostics if not specified.
478    ///
479    /// Default: warning
480    #[serde(default)]
481    pub diagnostics_max_severity: Option<DiagnosticSeverity>,
482}
483
484// Toolbar related settings
485#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
486pub struct ToolbarContent {
487    /// Whether to display breadcrumbs in the editor toolbar.
488    ///
489    /// Default: true
490    pub breadcrumbs: Option<bool>,
491    /// Whether to display quick action buttons in the editor toolbar.
492    ///
493    /// Default: true
494    pub quick_actions: Option<bool>,
495    /// Whether to show the selections menu in the editor toolbar.
496    ///
497    /// Default: true
498    pub selections_menu: Option<bool>,
499    /// Whether to display Agent review buttons in the editor toolbar.
500    /// Only applicable while reviewing a file edited by the Agent.
501    ///
502    /// Default: true
503    pub agent_review: Option<bool>,
504}
505
506/// Scrollbar related settings
507#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Default)]
508pub struct ScrollbarContent {
509    /// When to show the scrollbar in the editor.
510    ///
511    /// Default: auto
512    pub show: Option<ShowScrollbar>,
513    /// Whether to show git diff indicators in the scrollbar.
514    ///
515    /// Default: true
516    pub git_diff: Option<bool>,
517    /// Whether to show buffer search result indicators in the scrollbar.
518    ///
519    /// Default: true
520    pub search_results: Option<bool>,
521    /// Whether to show selected text occurrences in the scrollbar.
522    ///
523    /// Default: true
524    pub selected_text: Option<bool>,
525    /// Whether to show selected symbol occurrences in the scrollbar.
526    ///
527    /// Default: true
528    pub selected_symbol: Option<bool>,
529    /// Which diagnostic indicators to show in the scrollbar:
530    ///
531    /// Default: all
532    pub diagnostics: Option<ScrollbarDiagnostics>,
533    /// Whether to show cursor positions in the scrollbar.
534    ///
535    /// Default: true
536    pub cursors: Option<bool>,
537    /// Forcefully enable or disable the scrollbar for each axis
538    pub axes: Option<ScrollbarAxesContent>,
539}
540
541/// Minimap related settings
542#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq)]
543pub struct MinimapContent {
544    /// When to show the minimap in the editor.
545    ///
546    /// Default: never
547    pub show: Option<ShowMinimap>,
548
549    /// When to show the minimap thumb.
550    ///
551    /// Default: always
552    pub thumb: Option<MinimapThumb>,
553
554    /// Defines the border style for the minimap's scrollbar thumb.
555    ///
556    /// Default: left_open
557    pub thumb_border: Option<MinimapThumbBorder>,
558
559    /// How to highlight the current line in the minimap.
560    ///
561    /// Default: inherits editor line highlights setting
562    pub current_line_highlight: Option<Option<CurrentLineHighlight>>,
563}
564
565/// Forcefully enable or disable the scrollbar for each axis
566#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Default)]
567pub struct ScrollbarAxesContent {
568    /// When false, forcefully disables the horizontal scrollbar. Otherwise, obey other settings.
569    ///
570    /// Default: true
571    horizontal: Option<bool>,
572
573    /// When false, forcefully disables the vertical scrollbar. Otherwise, obey other settings.
574    ///
575    /// Default: true
576    vertical: Option<bool>,
577}
578
579/// Gutter related settings
580#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
581pub struct GutterContent {
582    /// Whether to show line numbers in the gutter.
583    ///
584    /// Default: true
585    pub line_numbers: Option<bool>,
586    /// Whether to show runnable buttons in the gutter.
587    ///
588    /// Default: true
589    pub runnables: Option<bool>,
590    /// Whether to show breakpoints in the gutter.
591    ///
592    /// Default: true
593    pub breakpoints: Option<bool>,
594    /// Whether to show fold buttons in the gutter.
595    ///
596    /// Default: true
597    pub folds: Option<bool>,
598}
599
600impl EditorSettings {
601    pub fn jupyter_enabled(cx: &App) -> bool {
602        EditorSettings::get_global(cx).jupyter.enabled
603    }
604}
605
606impl Settings for EditorSettings {
607    const KEY: Option<&'static str> = None;
608
609    type FileContent = EditorSettingsContent;
610
611    fn load(sources: SettingsSources<Self::FileContent>, _: &mut App) -> anyhow::Result<Self> {
612        sources.json_merge()
613    }
614
615    fn import_from_vscode(vscode: &VsCodeSettings, current: &mut Self::FileContent) {
616        vscode.enum_setting(
617            "editor.cursorBlinking",
618            &mut current.cursor_blink,
619            |s| match s {
620                "blink" | "phase" | "expand" | "smooth" => Some(true),
621                "solid" => Some(false),
622                _ => None,
623            },
624        );
625        vscode.enum_setting(
626            "editor.cursorStyle",
627            &mut current.cursor_shape,
628            |s| match s {
629                "block" => Some(CursorShape::Block),
630                "block-outline" => Some(CursorShape::Hollow),
631                "line" | "line-thin" => Some(CursorShape::Bar),
632                "underline" | "underline-thin" => Some(CursorShape::Underline),
633                _ => None,
634            },
635        );
636
637        vscode.enum_setting(
638            "editor.renderLineHighlight",
639            &mut current.current_line_highlight,
640            |s| match s {
641                "gutter" => Some(CurrentLineHighlight::Gutter),
642                "line" => Some(CurrentLineHighlight::Line),
643                "all" => Some(CurrentLineHighlight::All),
644                _ => None,
645            },
646        );
647
648        vscode.bool_setting(
649            "editor.selectionHighlight",
650            &mut current.selection_highlight,
651        );
652        vscode.bool_setting("editor.hover.enabled", &mut current.hover_popover_enabled);
653        vscode.u64_setting("editor.hover.delay", &mut current.hover_popover_delay);
654
655        let mut gutter = GutterContent::default();
656        vscode.enum_setting(
657            "editor.showFoldingControls",
658            &mut gutter.folds,
659            |s| match s {
660                "always" | "mouseover" => Some(true),
661                "never" => Some(false),
662                _ => None,
663            },
664        );
665        vscode.enum_setting(
666            "editor.lineNumbers",
667            &mut gutter.line_numbers,
668            |s| match s {
669                "on" | "relative" => Some(true),
670                "off" => Some(false),
671                _ => None,
672            },
673        );
674        if let Some(old_gutter) = current.gutter.as_mut() {
675            if gutter.folds.is_some() {
676                old_gutter.folds = gutter.folds
677            }
678            if gutter.line_numbers.is_some() {
679                old_gutter.line_numbers = gutter.line_numbers
680            }
681        } else {
682            if gutter != GutterContent::default() {
683                current.gutter = Some(gutter)
684            }
685        }
686        if let Some(b) = vscode.read_bool("editor.scrollBeyondLastLine") {
687            current.scroll_beyond_last_line = Some(if b {
688                ScrollBeyondLastLine::OnePage
689            } else {
690                ScrollBeyondLastLine::Off
691            })
692        }
693
694        let mut scrollbar_axes = ScrollbarAxesContent::default();
695        vscode.enum_setting(
696            "editor.scrollbar.horizontal",
697            &mut scrollbar_axes.horizontal,
698            |s| match s {
699                "auto" | "visible" => Some(true),
700                "hidden" => Some(false),
701                _ => None,
702            },
703        );
704        vscode.enum_setting(
705            "editor.scrollbar.vertical",
706            &mut scrollbar_axes.horizontal,
707            |s| match s {
708                "auto" | "visible" => Some(true),
709                "hidden" => Some(false),
710                _ => None,
711            },
712        );
713
714        if scrollbar_axes != ScrollbarAxesContent::default() {
715            let scrollbar_settings = current.scrollbar.get_or_insert_default();
716            let axes_settings = scrollbar_settings.axes.get_or_insert_default();
717
718            if let Some(vertical) = scrollbar_axes.vertical {
719                axes_settings.vertical = Some(vertical);
720            }
721            if let Some(horizontal) = scrollbar_axes.horizontal {
722                axes_settings.horizontal = Some(horizontal);
723            }
724        }
725
726        // TODO: check if this does the int->float conversion?
727        vscode.f32_setting(
728            "editor.cursorSurroundingLines",
729            &mut current.vertical_scroll_margin,
730        );
731        vscode.f32_setting(
732            "editor.mouseWheelScrollSensitivity",
733            &mut current.scroll_sensitivity,
734        );
735        if Some("relative") == vscode.read_string("editor.lineNumbers") {
736            current.relative_line_numbers = Some(true);
737        }
738
739        vscode.enum_setting(
740            "editor.find.seedSearchStringFromSelection",
741            &mut current.seed_search_query_from_cursor,
742            |s| match s {
743                "always" => Some(SeedQuerySetting::Always),
744                "selection" => Some(SeedQuerySetting::Selection),
745                "never" => Some(SeedQuerySetting::Never),
746                _ => None,
747            },
748        );
749        vscode.bool_setting("search.smartCase", &mut current.use_smartcase_search);
750        vscode.enum_setting(
751            "editor.multiCursorModifier",
752            &mut current.multi_cursor_modifier,
753            |s| match s {
754                "ctrlCmd" => Some(MultiCursorModifier::CmdOrCtrl),
755                "alt" => Some(MultiCursorModifier::Alt),
756                _ => None,
757            },
758        );
759
760        vscode.bool_setting(
761            "editor.parameterHints.enabled",
762            &mut current.auto_signature_help,
763        );
764        vscode.bool_setting(
765            "editor.parameterHints.enabled",
766            &mut current.show_signature_help_after_edits,
767        );
768
769        if let Some(use_ignored) = vscode.read_bool("search.useIgnoreFiles") {
770            let search = current.search.get_or_insert_default();
771            search.include_ignored = use_ignored;
772        }
773    }
774}