editor_settings.rs

  1use core::num;
  2use std::num::NonZeroU32;
  3
  4use gpui::App;
  5use language::CursorShape;
  6use project::project_settings::DiagnosticSeverity;
  7pub use settings::{
  8    CurrentLineHighlight, DisplayIn, DocumentColorsRenderMode, DoubleClickInMultibuffer,
  9    GoToDefinitionFallback, HideMouseMode, MinimapThumb, MinimapThumbBorder, MultiCursorModifier,
 10    ScrollBeyondLastLine, ScrollbarDiagnostics, SeedQuerySetting, ShowMinimap, SnippetSortOrder,
 11    VsCodeSettings,
 12};
 13use settings::{Settings, SettingsContent};
 14use ui::scrollbars::{ScrollbarVisibility, ShowScrollbar};
 15use util::MergeFrom;
 16
 17/// Imports from the VSCode settings at
 18/// https://code.visualstudio.com/docs/reference/default-settings
 19#[derive(Clone)]
 20pub struct EditorSettings {
 21    pub cursor_blink: bool,
 22    pub cursor_shape: Option<CursorShape>,
 23    pub current_line_highlight: CurrentLineHighlight,
 24    pub selection_highlight: bool,
 25    pub rounded_selection: bool,
 26    pub lsp_highlight_debounce: u64,
 27    pub hover_popover_enabled: bool,
 28    pub hover_popover_delay: u64,
 29    pub status_bar: StatusBar,
 30    pub toolbar: Toolbar,
 31    pub scrollbar: Scrollbar,
 32    pub minimap: Minimap,
 33    pub gutter: Gutter,
 34    pub scroll_beyond_last_line: ScrollBeyondLastLine,
 35    pub vertical_scroll_margin: f32,
 36    pub autoscroll_on_clicks: bool,
 37    pub horizontal_scroll_margin: f32,
 38    pub scroll_sensitivity: f32,
 39    pub fast_scroll_sensitivity: f32,
 40    pub relative_line_numbers: bool,
 41    pub seed_search_query_from_cursor: SeedQuerySetting,
 42    pub use_smartcase_search: bool,
 43    pub multi_cursor_modifier: MultiCursorModifier,
 44    pub redact_private_values: bool,
 45    pub expand_excerpt_lines: u32,
 46    pub excerpt_context_lines: u32,
 47    pub middle_click_paste: bool,
 48    pub double_click_in_multibuffer: DoubleClickInMultibuffer,
 49    pub search_wrap: bool,
 50    pub search: SearchSettings,
 51    pub auto_signature_help: bool,
 52    pub show_signature_help_after_edits: bool,
 53    pub go_to_definition_fallback: GoToDefinitionFallback,
 54    pub jupyter: Jupyter,
 55    pub hide_mouse: Option<HideMouseMode>,
 56    pub snippet_sort_order: SnippetSortOrder,
 57    pub diagnostics_max_severity: Option<DiagnosticSeverity>,
 58    pub inline_code_actions: bool,
 59    pub drag_and_drop_selection: DragAndDropSelection,
 60    pub lsp_document_colors: DocumentColorsRenderMode,
 61    pub minimum_contrast_for_highlights: f32,
 62}
 63#[derive(Debug, Clone)]
 64pub struct Jupyter {
 65    /// Whether the Jupyter feature is enabled.
 66    ///
 67    /// Default: true
 68    pub enabled: bool,
 69}
 70
 71#[derive(Clone, Debug, PartialEq, Eq)]
 72pub struct StatusBar {
 73    /// Whether to display the active language button in the status bar.
 74    ///
 75    /// Default: true
 76    pub active_language_button: bool,
 77    /// Whether to show the cursor position button in the status bar.
 78    ///
 79    /// Default: true
 80    pub cursor_position_button: bool,
 81}
 82
 83#[derive(Clone, Debug, PartialEq, Eq)]
 84pub struct Toolbar {
 85    pub breadcrumbs: bool,
 86    pub quick_actions: bool,
 87    pub selections_menu: bool,
 88    pub agent_review: bool,
 89    pub code_actions: bool,
 90}
 91
 92#[derive(Copy, Clone, Debug, PartialEq, Eq)]
 93pub struct Scrollbar {
 94    pub show: ShowScrollbar,
 95    pub git_diff: bool,
 96    pub selected_text: bool,
 97    pub selected_symbol: bool,
 98    pub search_results: bool,
 99    pub diagnostics: ScrollbarDiagnostics,
100    pub cursors: bool,
101    pub axes: ScrollbarAxes,
102}
103
104#[derive(Copy, Clone, Debug, PartialEq)]
105pub struct Minimap {
106    pub show: ShowMinimap,
107    pub display_in: DisplayIn,
108    pub thumb: MinimapThumb,
109    pub thumb_border: MinimapThumbBorder,
110    pub current_line_highlight: Option<CurrentLineHighlight>,
111    pub max_width_columns: num::NonZeroU32,
112}
113
114impl Minimap {
115    pub fn minimap_enabled(&self) -> bool {
116        self.show != ShowMinimap::Never
117    }
118
119    #[inline]
120    pub fn on_active_editor(&self) -> bool {
121        self.display_in == DisplayIn::ActiveEditor
122    }
123
124    pub fn with_show_override(self) -> Self {
125        Self {
126            show: ShowMinimap::Always,
127            ..self
128        }
129    }
130}
131
132#[derive(Copy, Clone, Debug, PartialEq, Eq)]
133pub struct Gutter {
134    pub min_line_number_digits: usize,
135    pub line_numbers: bool,
136    pub runnables: bool,
137    pub breakpoints: bool,
138    pub folds: bool,
139}
140
141/// Forcefully enable or disable the scrollbar for each axis
142#[derive(Copy, Clone, Debug, PartialEq, Eq)]
143pub struct ScrollbarAxes {
144    /// When false, forcefully disables the horizontal scrollbar. Otherwise, obey other settings.
145    ///
146    /// Default: true
147    pub horizontal: bool,
148
149    /// When false, forcefully disables the vertical scrollbar. Otherwise, obey other settings.
150    ///
151    /// Default: true
152    pub vertical: bool,
153}
154
155/// Whether to allow drag and drop text selection in buffer.
156#[derive(Copy, Clone, Default, Debug, PartialEq, Eq)]
157pub struct DragAndDropSelection {
158    /// When true, enables drag and drop text selection in buffer.
159    ///
160    /// Default: true
161    pub enabled: bool,
162
163    /// The delay in milliseconds that must elapse before drag and drop is allowed. Otherwise, a new text selection is created.
164    ///
165    /// Default: 300
166    pub delay: u64,
167}
168
169/// Default options for buffer and project search items.
170#[derive(Copy, Clone, Default, Debug, PartialEq, Eq)]
171pub struct SearchSettings {
172    /// Whether to show the project search button in the status bar.
173    pub button: bool,
174    pub whole_word: bool,
175    pub case_sensitive: bool,
176    pub include_ignored: bool,
177    pub regex: bool,
178}
179
180impl EditorSettings {
181    pub fn jupyter_enabled(cx: &App) -> bool {
182        EditorSettings::get_global(cx).jupyter.enabled
183    }
184}
185
186impl ScrollbarVisibility for EditorSettings {
187    fn visibility(&self, _cx: &App) -> ShowScrollbar {
188        self.scrollbar.show
189    }
190}
191
192impl Settings for EditorSettings {
193    fn from_defaults(content: &settings::SettingsContent, _cx: &mut App) -> Self {
194        let editor = content.editor.clone();
195        let scrollbar = editor.scrollbar.unwrap();
196        let minimap = editor.minimap.unwrap();
197        let gutter = editor.gutter.unwrap();
198        let axes = scrollbar.axes.unwrap();
199        let status_bar = editor.status_bar.unwrap();
200        let toolbar = editor.toolbar.unwrap();
201        let search = editor.search.unwrap();
202        let drag_and_drop_selection = editor.drag_and_drop_selection.unwrap();
203        Self {
204            cursor_blink: editor.cursor_blink.unwrap(),
205            cursor_shape: editor.cursor_shape.map(Into::into),
206            current_line_highlight: editor.current_line_highlight.unwrap(),
207            selection_highlight: editor.selection_highlight.unwrap(),
208            rounded_selection: editor.rounded_selection.unwrap(),
209            lsp_highlight_debounce: editor.lsp_highlight_debounce.unwrap(),
210            hover_popover_enabled: editor.hover_popover_enabled.unwrap(),
211            hover_popover_delay: editor.hover_popover_delay.unwrap(),
212            status_bar: StatusBar {
213                active_language_button: status_bar.active_language_button.unwrap(),
214                cursor_position_button: status_bar.cursor_position_button.unwrap(),
215            },
216            toolbar: Toolbar {
217                breadcrumbs: toolbar.breadcrumbs.unwrap(),
218                quick_actions: toolbar.quick_actions.unwrap(),
219                selections_menu: toolbar.selections_menu.unwrap(),
220                agent_review: toolbar.agent_review.unwrap(),
221                code_actions: toolbar.code_actions.unwrap(),
222            },
223            scrollbar: Scrollbar {
224                show: scrollbar.show.map(Into::into).unwrap(),
225                git_diff: scrollbar.git_diff.unwrap(),
226                selected_text: scrollbar.selected_text.unwrap(),
227                selected_symbol: scrollbar.selected_symbol.unwrap(),
228                search_results: scrollbar.search_results.unwrap(),
229                diagnostics: scrollbar.diagnostics.unwrap(),
230                cursors: scrollbar.cursors.unwrap(),
231                axes: ScrollbarAxes {
232                    horizontal: axes.horizontal.unwrap(),
233                    vertical: axes.vertical.unwrap(),
234                },
235            },
236            minimap: Minimap {
237                show: minimap.show.unwrap(),
238                display_in: minimap.display_in.unwrap(),
239                thumb: minimap.thumb.unwrap(),
240                thumb_border: minimap.thumb_border.unwrap(),
241                current_line_highlight: minimap.current_line_highlight.flatten(),
242                max_width_columns: minimap.max_width_columns.unwrap(),
243            },
244            gutter: Gutter {
245                min_line_number_digits: gutter.min_line_number_digits.unwrap(),
246                line_numbers: gutter.line_numbers.unwrap(),
247                runnables: gutter.runnables.unwrap(),
248                breakpoints: gutter.breakpoints.unwrap(),
249                folds: gutter.folds.unwrap(),
250            },
251            scroll_beyond_last_line: editor.scroll_beyond_last_line.unwrap(),
252            vertical_scroll_margin: editor.vertical_scroll_margin.unwrap(),
253            autoscroll_on_clicks: editor.autoscroll_on_clicks.unwrap(),
254            horizontal_scroll_margin: editor.horizontal_scroll_margin.unwrap(),
255            scroll_sensitivity: editor.scroll_sensitivity.unwrap(),
256            fast_scroll_sensitivity: editor.fast_scroll_sensitivity.unwrap(),
257            relative_line_numbers: editor.relative_line_numbers.unwrap(),
258            seed_search_query_from_cursor: editor.seed_search_query_from_cursor.unwrap(),
259            use_smartcase_search: editor.use_smartcase_search.unwrap(),
260            multi_cursor_modifier: editor.multi_cursor_modifier.unwrap(),
261            redact_private_values: editor.redact_private_values.unwrap(),
262            expand_excerpt_lines: editor.expand_excerpt_lines.unwrap(),
263            excerpt_context_lines: editor.excerpt_context_lines.unwrap(),
264            middle_click_paste: editor.middle_click_paste.unwrap(),
265            double_click_in_multibuffer: editor.double_click_in_multibuffer.unwrap(),
266            search_wrap: editor.search_wrap.unwrap(),
267            search: SearchSettings {
268                button: search.button.unwrap(),
269                whole_word: search.whole_word.unwrap(),
270                case_sensitive: search.case_sensitive.unwrap(),
271                include_ignored: search.include_ignored.unwrap(),
272                regex: search.regex.unwrap(),
273            },
274            auto_signature_help: editor.auto_signature_help.unwrap(),
275            show_signature_help_after_edits: editor.show_signature_help_after_edits.unwrap(),
276            go_to_definition_fallback: editor.go_to_definition_fallback.unwrap(),
277            jupyter: Jupyter {
278                enabled: editor.jupyter.unwrap().enabled.unwrap(),
279            },
280            hide_mouse: editor.hide_mouse,
281            snippet_sort_order: editor.snippet_sort_order.unwrap(),
282            diagnostics_max_severity: editor.diagnostics_max_severity.map(Into::into),
283            inline_code_actions: editor.inline_code_actions.unwrap(),
284            drag_and_drop_selection: DragAndDropSelection {
285                enabled: drag_and_drop_selection.enabled.unwrap(),
286                delay: drag_and_drop_selection.delay.unwrap(),
287            },
288            lsp_document_colors: editor.lsp_document_colors.unwrap(),
289            minimum_contrast_for_highlights: editor.minimum_contrast_for_highlights.unwrap(),
290        }
291    }
292
293    fn refine(&mut self, content: &settings::SettingsContent, _cx: &mut App) {
294        let editor = &content.editor;
295        self.cursor_blink.merge_from(&editor.cursor_blink);
296        if let Some(cursor_shape) = editor.cursor_shape {
297            self.cursor_shape = Some(cursor_shape.into())
298        }
299        self.current_line_highlight
300            .merge_from(&editor.current_line_highlight);
301        self.selection_highlight
302            .merge_from(&editor.selection_highlight);
303        self.rounded_selection.merge_from(&editor.rounded_selection);
304        self.lsp_highlight_debounce
305            .merge_from(&editor.lsp_highlight_debounce);
306        self.hover_popover_enabled
307            .merge_from(&editor.hover_popover_enabled);
308        self.hover_popover_delay
309            .merge_from(&editor.hover_popover_delay);
310        self.scroll_beyond_last_line
311            .merge_from(&editor.scroll_beyond_last_line);
312        self.vertical_scroll_margin
313            .merge_from(&editor.vertical_scroll_margin);
314        self.autoscroll_on_clicks
315            .merge_from(&editor.autoscroll_on_clicks);
316        self.horizontal_scroll_margin
317            .merge_from(&editor.horizontal_scroll_margin);
318        self.scroll_sensitivity
319            .merge_from(&editor.scroll_sensitivity);
320        self.fast_scroll_sensitivity
321            .merge_from(&editor.fast_scroll_sensitivity);
322        self.relative_line_numbers
323            .merge_from(&editor.relative_line_numbers);
324        self.seed_search_query_from_cursor
325            .merge_from(&editor.seed_search_query_from_cursor);
326        self.use_smartcase_search
327            .merge_from(&editor.use_smartcase_search);
328        self.multi_cursor_modifier
329            .merge_from(&editor.multi_cursor_modifier);
330        self.redact_private_values
331            .merge_from(&editor.redact_private_values);
332        self.expand_excerpt_lines
333            .merge_from(&editor.expand_excerpt_lines);
334        self.excerpt_context_lines
335            .merge_from(&editor.excerpt_context_lines);
336        self.middle_click_paste
337            .merge_from(&editor.middle_click_paste);
338        self.double_click_in_multibuffer
339            .merge_from(&editor.double_click_in_multibuffer);
340        self.search_wrap.merge_from(&editor.search_wrap);
341        self.auto_signature_help
342            .merge_from(&editor.auto_signature_help);
343        self.show_signature_help_after_edits
344            .merge_from(&editor.show_signature_help_after_edits);
345        self.go_to_definition_fallback
346            .merge_from(&editor.go_to_definition_fallback);
347        if let Some(hide_mouse) = editor.hide_mouse {
348            self.hide_mouse = Some(hide_mouse)
349        }
350        self.snippet_sort_order
351            .merge_from(&editor.snippet_sort_order);
352        if let Some(diagnostics_max_severity) = editor.diagnostics_max_severity {
353            self.diagnostics_max_severity = Some(diagnostics_max_severity.into());
354        }
355        self.inline_code_actions
356            .merge_from(&editor.inline_code_actions);
357        self.lsp_document_colors
358            .merge_from(&editor.lsp_document_colors);
359        self.minimum_contrast_for_highlights
360            .merge_from(&editor.minimum_contrast_for_highlights);
361
362        if let Some(status_bar) = &editor.status_bar {
363            self.status_bar
364                .active_language_button
365                .merge_from(&status_bar.active_language_button);
366            self.status_bar
367                .cursor_position_button
368                .merge_from(&status_bar.cursor_position_button);
369        }
370        if let Some(toolbar) = &editor.toolbar {
371            self.toolbar.breadcrumbs.merge_from(&toolbar.breadcrumbs);
372            self.toolbar
373                .quick_actions
374                .merge_from(&toolbar.quick_actions);
375            self.toolbar
376                .selections_menu
377                .merge_from(&toolbar.selections_menu);
378            self.toolbar.agent_review.merge_from(&toolbar.agent_review);
379            self.toolbar.code_actions.merge_from(&toolbar.code_actions);
380        }
381        if let Some(scrollbar) = &editor.scrollbar {
382            self.scrollbar
383                .show
384                .merge_from(&scrollbar.show.map(Into::into));
385            self.scrollbar.git_diff.merge_from(&scrollbar.git_diff);
386            self.scrollbar
387                .selected_text
388                .merge_from(&scrollbar.selected_text);
389            self.scrollbar
390                .selected_symbol
391                .merge_from(&scrollbar.selected_symbol);
392            self.scrollbar
393                .search_results
394                .merge_from(&scrollbar.search_results);
395            self.scrollbar
396                .diagnostics
397                .merge_from(&scrollbar.diagnostics);
398            self.scrollbar.cursors.merge_from(&scrollbar.cursors);
399            if let Some(axes) = &scrollbar.axes {
400                self.scrollbar.axes.horizontal.merge_from(&axes.horizontal);
401                self.scrollbar.axes.vertical.merge_from(&axes.vertical);
402            }
403        }
404        if let Some(minimap) = &editor.minimap {
405            self.minimap.show.merge_from(&minimap.show);
406            self.minimap.display_in.merge_from(&minimap.display_in);
407            self.minimap.thumb.merge_from(&minimap.thumb);
408            self.minimap.thumb_border.merge_from(&minimap.thumb_border);
409            self.minimap
410                .current_line_highlight
411                .merge_from(&minimap.current_line_highlight);
412            self.minimap
413                .max_width_columns
414                .merge_from(&minimap.max_width_columns);
415        }
416        if let Some(gutter) = &editor.gutter {
417            self.gutter
418                .min_line_number_digits
419                .merge_from(&gutter.min_line_number_digits);
420            self.gutter.line_numbers.merge_from(&gutter.line_numbers);
421            self.gutter.runnables.merge_from(&gutter.runnables);
422            self.gutter.breakpoints.merge_from(&gutter.breakpoints);
423            self.gutter.folds.merge_from(&gutter.folds);
424        }
425        if let Some(search) = &editor.search {
426            self.search.button.merge_from(&search.button);
427            self.search.whole_word.merge_from(&search.whole_word);
428            self.search
429                .case_sensitive
430                .merge_from(&search.case_sensitive);
431            self.search
432                .include_ignored
433                .merge_from(&search.include_ignored);
434            self.search.regex.merge_from(&search.regex);
435        }
436        if let Some(enabled) = editor.jupyter.as_ref().and_then(|jupyter| jupyter.enabled) {
437            self.jupyter.enabled = enabled;
438        }
439        if let Some(drag_and_drop_selection) = &editor.drag_and_drop_selection {
440            self.drag_and_drop_selection
441                .enabled
442                .merge_from(&drag_and_drop_selection.enabled);
443            self.drag_and_drop_selection
444                .delay
445                .merge_from(&drag_and_drop_selection.delay);
446        }
447    }
448
449    fn import_from_vscode(vscode: &VsCodeSettings, current: &mut SettingsContent) {
450        vscode.enum_setting(
451            "editor.cursorBlinking",
452            &mut current.editor.cursor_blink,
453            |s| match s {
454                "blink" | "phase" | "expand" | "smooth" => Some(true),
455                "solid" => Some(false),
456                _ => None,
457            },
458        );
459        vscode.enum_setting(
460            "editor.cursorStyle",
461            &mut current.editor.cursor_shape,
462            |s| match s {
463                "block" => Some(settings::CursorShape::Block),
464                "block-outline" => Some(settings::CursorShape::Hollow),
465                "line" | "line-thin" => Some(settings::CursorShape::Bar),
466                "underline" | "underline-thin" => Some(settings::CursorShape::Underline),
467                _ => None,
468            },
469        );
470
471        vscode.enum_setting(
472            "editor.renderLineHighlight",
473            &mut current.editor.current_line_highlight,
474            |s| match s {
475                "gutter" => Some(CurrentLineHighlight::Gutter),
476                "line" => Some(CurrentLineHighlight::Line),
477                "all" => Some(CurrentLineHighlight::All),
478                _ => None,
479            },
480        );
481
482        vscode.bool_setting(
483            "editor.selectionHighlight",
484            &mut current.editor.selection_highlight,
485        );
486        vscode.bool_setting(
487            "editor.roundedSelection",
488            &mut current.editor.rounded_selection,
489        );
490        vscode.bool_setting(
491            "editor.hover.enabled",
492            &mut current.editor.hover_popover_enabled,
493        );
494        vscode.u64_setting(
495            "editor.hover.delay",
496            &mut current.editor.hover_popover_delay,
497        );
498
499        let mut gutter = settings::GutterContent::default();
500        vscode.enum_setting(
501            "editor.showFoldingControls",
502            &mut gutter.folds,
503            |s| match s {
504                "always" | "mouseover" => Some(true),
505                "never" => Some(false),
506                _ => None,
507            },
508        );
509        vscode.enum_setting(
510            "editor.lineNumbers",
511            &mut gutter.line_numbers,
512            |s| match s {
513                "on" | "relative" => Some(true),
514                "off" => Some(false),
515                _ => None,
516            },
517        );
518        if let Some(old_gutter) = current.editor.gutter.as_mut() {
519            if gutter.folds.is_some() {
520                old_gutter.folds = gutter.folds
521            }
522            if gutter.line_numbers.is_some() {
523                old_gutter.line_numbers = gutter.line_numbers
524            }
525        } else if gutter != settings::GutterContent::default() {
526            current.editor.gutter = Some(gutter)
527        }
528        if let Some(b) = vscode.read_bool("editor.scrollBeyondLastLine") {
529            current.editor.scroll_beyond_last_line = Some(if b {
530                ScrollBeyondLastLine::OnePage
531            } else {
532                ScrollBeyondLastLine::Off
533            })
534        }
535
536        let mut scrollbar_axes = settings::ScrollbarAxesContent::default();
537        vscode.enum_setting(
538            "editor.scrollbar.horizontal",
539            &mut scrollbar_axes.horizontal,
540            |s| match s {
541                "auto" | "visible" => Some(true),
542                "hidden" => Some(false),
543                _ => None,
544            },
545        );
546        vscode.enum_setting(
547            "editor.scrollbar.vertical",
548            &mut scrollbar_axes.horizontal,
549            |s| match s {
550                "auto" | "visible" => Some(true),
551                "hidden" => Some(false),
552                _ => None,
553            },
554        );
555
556        if scrollbar_axes != settings::ScrollbarAxesContent::default() {
557            let scrollbar_settings = current.editor.scrollbar.get_or_insert_default();
558            let axes_settings = scrollbar_settings.axes.get_or_insert_default();
559
560            if let Some(vertical) = scrollbar_axes.vertical {
561                axes_settings.vertical = Some(vertical);
562            }
563            if let Some(horizontal) = scrollbar_axes.horizontal {
564                axes_settings.horizontal = Some(horizontal);
565            }
566        }
567
568        // TODO: check if this does the int->float conversion?
569        vscode.f32_setting(
570            "editor.cursorSurroundingLines",
571            &mut current.editor.vertical_scroll_margin,
572        );
573        vscode.f32_setting(
574            "editor.mouseWheelScrollSensitivity",
575            &mut current.editor.scroll_sensitivity,
576        );
577        vscode.f32_setting(
578            "editor.fastScrollSensitivity",
579            &mut current.editor.fast_scroll_sensitivity,
580        );
581        if Some("relative") == vscode.read_string("editor.lineNumbers") {
582            current.editor.relative_line_numbers = Some(true);
583        }
584
585        vscode.enum_setting(
586            "editor.find.seedSearchStringFromSelection",
587            &mut current.editor.seed_search_query_from_cursor,
588            |s| match s {
589                "always" => Some(SeedQuerySetting::Always),
590                "selection" => Some(SeedQuerySetting::Selection),
591                "never" => Some(SeedQuerySetting::Never),
592                _ => None,
593            },
594        );
595        vscode.bool_setting("search.smartCase", &mut current.editor.use_smartcase_search);
596        vscode.enum_setting(
597            "editor.multiCursorModifier",
598            &mut current.editor.multi_cursor_modifier,
599            |s| match s {
600                "ctrlCmd" => Some(MultiCursorModifier::CmdOrCtrl),
601                "alt" => Some(MultiCursorModifier::Alt),
602                _ => None,
603            },
604        );
605
606        vscode.bool_setting(
607            "editor.parameterHints.enabled",
608            &mut current.editor.auto_signature_help,
609        );
610        vscode.bool_setting(
611            "editor.parameterHints.enabled",
612            &mut current.editor.show_signature_help_after_edits,
613        );
614
615        if let Some(use_ignored) = vscode.read_bool("search.useIgnoreFiles") {
616            let search = current.editor.search.get_or_insert_default();
617            search.include_ignored = Some(use_ignored);
618        }
619
620        let mut minimap = settings::MinimapContent::default();
621        let minimap_enabled = vscode.read_bool("editor.minimap.enabled").unwrap_or(true);
622        let autohide = vscode.read_bool("editor.minimap.autohide");
623        let mut max_width_columns: Option<u32> = None;
624        vscode.u32_setting("editor.minimap.maxColumn", &mut max_width_columns);
625        if minimap_enabled {
626            if let Some(false) = autohide {
627                minimap.show = Some(ShowMinimap::Always);
628            } else {
629                minimap.show = Some(ShowMinimap::Auto);
630            }
631        } else {
632            minimap.show = Some(ShowMinimap::Never);
633        }
634        if let Some(max_width_columns) = max_width_columns {
635            minimap.max_width_columns = NonZeroU32::new(max_width_columns);
636        }
637
638        vscode.enum_setting(
639            "editor.minimap.showSlider",
640            &mut minimap.thumb,
641            |s| match s {
642                "always" => Some(MinimapThumb::Always),
643                "mouseover" => Some(MinimapThumb::Hover),
644                _ => None,
645            },
646        );
647
648        if minimap != settings::MinimapContent::default() {
649            current.editor.minimap = Some(minimap)
650        }
651    }
652}