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}
179impl EditorSettings {
180 pub fn jupyter_enabled(cx: &App) -> bool {
181 EditorSettings::get_global(cx).jupyter.enabled
182 }
183}
184
185impl ScrollbarVisibility for EditorSettings {
186 fn visibility(&self, _cx: &App) -> ShowScrollbar {
187 self.scrollbar.show
188 }
189}
190
191impl Settings for EditorSettings {
192 fn from_defaults(content: &settings::SettingsContent, _cx: &mut App) -> Self {
193 let editor = content.editor.clone();
194 let scrollbar = editor.scrollbar.unwrap();
195 let minimap = editor.minimap.unwrap();
196 let gutter = editor.gutter.unwrap();
197 let axes = scrollbar.axes.unwrap();
198 let status_bar = editor.status_bar.unwrap();
199 let toolbar = editor.toolbar.unwrap();
200 let search = editor.search.unwrap();
201 let drag_and_drop_selection = editor.drag_and_drop_selection.unwrap();
202 Self {
203 cursor_blink: editor.cursor_blink.unwrap(),
204 cursor_shape: editor.cursor_shape.map(Into::into),
205 current_line_highlight: editor.current_line_highlight.unwrap(),
206 selection_highlight: editor.selection_highlight.unwrap(),
207 rounded_selection: editor.rounded_selection.unwrap(),
208 lsp_highlight_debounce: editor.lsp_highlight_debounce.unwrap(),
209 hover_popover_enabled: editor.hover_popover_enabled.unwrap(),
210 hover_popover_delay: editor.hover_popover_delay.unwrap(),
211 status_bar: StatusBar {
212 active_language_button: status_bar.active_language_button.unwrap(),
213 cursor_position_button: status_bar.cursor_position_button.unwrap(),
214 },
215 toolbar: Toolbar {
216 breadcrumbs: toolbar.breadcrumbs.unwrap(),
217 quick_actions: toolbar.quick_actions.unwrap(),
218 selections_menu: toolbar.selections_menu.unwrap(),
219 agent_review: toolbar.agent_review.unwrap(),
220 code_actions: toolbar.code_actions.unwrap(),
221 },
222 scrollbar: Scrollbar {
223 show: scrollbar.show.map(Into::into).unwrap(),
224 git_diff: scrollbar.git_diff.unwrap(),
225 selected_text: scrollbar.selected_text.unwrap(),
226 selected_symbol: scrollbar.selected_symbol.unwrap(),
227 search_results: scrollbar.search_results.unwrap(),
228 diagnostics: scrollbar.diagnostics.unwrap(),
229 cursors: scrollbar.cursors.unwrap(),
230 axes: ScrollbarAxes {
231 horizontal: axes.horizontal.unwrap(),
232 vertical: axes.vertical.unwrap(),
233 },
234 },
235 minimap: Minimap {
236 show: minimap.show.unwrap(),
237 display_in: minimap.display_in.unwrap(),
238 thumb: minimap.thumb.unwrap(),
239 thumb_border: minimap.thumb_border.unwrap(),
240 current_line_highlight: minimap.current_line_highlight.flatten(),
241 max_width_columns: minimap.max_width_columns.unwrap(),
242 },
243 gutter: Gutter {
244 min_line_number_digits: gutter.min_line_number_digits.unwrap(),
245 line_numbers: gutter.line_numbers.unwrap(),
246 runnables: gutter.runnables.unwrap(),
247 breakpoints: gutter.breakpoints.unwrap(),
248 folds: gutter.folds.unwrap(),
249 },
250 scroll_beyond_last_line: editor.scroll_beyond_last_line.unwrap(),
251 vertical_scroll_margin: editor.vertical_scroll_margin.unwrap(),
252 autoscroll_on_clicks: editor.autoscroll_on_clicks.unwrap(),
253 horizontal_scroll_margin: editor.horizontal_scroll_margin.unwrap(),
254 scroll_sensitivity: editor.scroll_sensitivity.unwrap(),
255 fast_scroll_sensitivity: editor.fast_scroll_sensitivity.unwrap(),
256 relative_line_numbers: editor.relative_line_numbers.unwrap(),
257 seed_search_query_from_cursor: editor.seed_search_query_from_cursor.unwrap(),
258 use_smartcase_search: editor.use_smartcase_search.unwrap(),
259 multi_cursor_modifier: editor.multi_cursor_modifier.unwrap(),
260 redact_private_values: editor.redact_private_values.unwrap(),
261 expand_excerpt_lines: editor.expand_excerpt_lines.unwrap(),
262 excerpt_context_lines: editor.excerpt_context_lines.unwrap(),
263 middle_click_paste: editor.middle_click_paste.unwrap(),
264 double_click_in_multibuffer: editor.double_click_in_multibuffer.unwrap(),
265 search_wrap: editor.search_wrap.unwrap(),
266 search: SearchSettings {
267 button: search.button.unwrap(),
268 whole_word: search.whole_word.unwrap(),
269 case_sensitive: search.case_sensitive.unwrap(),
270 include_ignored: search.include_ignored.unwrap(),
271 regex: search.regex.unwrap(),
272 },
273 auto_signature_help: editor.auto_signature_help.unwrap(),
274 show_signature_help_after_edits: editor.show_signature_help_after_edits.unwrap(),
275 go_to_definition_fallback: editor.go_to_definition_fallback.unwrap(),
276 jupyter: Jupyter {
277 enabled: editor.jupyter.unwrap().enabled.unwrap(),
278 },
279 hide_mouse: editor.hide_mouse,
280 snippet_sort_order: editor.snippet_sort_order.unwrap(),
281 diagnostics_max_severity: editor.diagnostics_max_severity.map(Into::into),
282 inline_code_actions: editor.inline_code_actions.unwrap(),
283 drag_and_drop_selection: DragAndDropSelection {
284 enabled: drag_and_drop_selection.enabled.unwrap(),
285 delay: drag_and_drop_selection.delay.unwrap(),
286 },
287 lsp_document_colors: editor.lsp_document_colors.unwrap(),
288 minimum_contrast_for_highlights: editor.minimum_contrast_for_highlights.unwrap(),
289 }
290 }
291
292 fn refine(&mut self, content: &settings::SettingsContent, _cx: &mut App) {
293 let editor = &content.editor;
294 self.cursor_blink.merge_from(&editor.cursor_blink);
295 if let Some(cursor_shape) = editor.cursor_shape {
296 self.cursor_shape = Some(cursor_shape.into())
297 }
298 self.current_line_highlight
299 .merge_from(&editor.current_line_highlight);
300 self.selection_highlight
301 .merge_from(&editor.selection_highlight);
302 self.rounded_selection.merge_from(&editor.rounded_selection);
303 self.lsp_highlight_debounce
304 .merge_from(&editor.lsp_highlight_debounce);
305 self.hover_popover_enabled
306 .merge_from(&editor.hover_popover_enabled);
307 self.hover_popover_delay
308 .merge_from(&editor.hover_popover_delay);
309 self.scroll_beyond_last_line
310 .merge_from(&editor.scroll_beyond_last_line);
311 self.vertical_scroll_margin
312 .merge_from(&editor.vertical_scroll_margin);
313 self.autoscroll_on_clicks
314 .merge_from(&editor.autoscroll_on_clicks);
315 self.horizontal_scroll_margin
316 .merge_from(&editor.horizontal_scroll_margin);
317 self.scroll_sensitivity
318 .merge_from(&editor.scroll_sensitivity);
319 self.fast_scroll_sensitivity
320 .merge_from(&editor.fast_scroll_sensitivity);
321 self.relative_line_numbers
322 .merge_from(&editor.relative_line_numbers);
323 self.seed_search_query_from_cursor
324 .merge_from(&editor.seed_search_query_from_cursor);
325 self.use_smartcase_search
326 .merge_from(&editor.use_smartcase_search);
327 self.multi_cursor_modifier
328 .merge_from(&editor.multi_cursor_modifier);
329 self.redact_private_values
330 .merge_from(&editor.redact_private_values);
331 self.expand_excerpt_lines
332 .merge_from(&editor.expand_excerpt_lines);
333 self.excerpt_context_lines
334 .merge_from(&editor.excerpt_context_lines);
335 self.middle_click_paste
336 .merge_from(&editor.middle_click_paste);
337 self.double_click_in_multibuffer
338 .merge_from(&editor.double_click_in_multibuffer);
339 self.search_wrap.merge_from(&editor.search_wrap);
340 self.auto_signature_help
341 .merge_from(&editor.auto_signature_help);
342 self.show_signature_help_after_edits
343 .merge_from(&editor.show_signature_help_after_edits);
344 self.go_to_definition_fallback
345 .merge_from(&editor.go_to_definition_fallback);
346 if let Some(hide_mouse) = editor.hide_mouse {
347 self.hide_mouse = Some(hide_mouse)
348 }
349 self.snippet_sort_order
350 .merge_from(&editor.snippet_sort_order);
351 if let Some(diagnostics_max_severity) = editor.diagnostics_max_severity {
352 self.diagnostics_max_severity = Some(diagnostics_max_severity.into());
353 }
354 self.inline_code_actions
355 .merge_from(&editor.inline_code_actions);
356 self.lsp_document_colors
357 .merge_from(&editor.lsp_document_colors);
358 self.minimum_contrast_for_highlights
359 .merge_from(&editor.minimum_contrast_for_highlights);
360
361 if let Some(status_bar) = &editor.status_bar {
362 self.status_bar
363 .active_language_button
364 .merge_from(&status_bar.active_language_button);
365 self.status_bar
366 .cursor_position_button
367 .merge_from(&status_bar.cursor_position_button);
368 }
369 if let Some(toolbar) = &editor.toolbar {
370 self.toolbar.breadcrumbs.merge_from(&toolbar.breadcrumbs);
371 self.toolbar
372 .quick_actions
373 .merge_from(&toolbar.quick_actions);
374 self.toolbar
375 .selections_menu
376 .merge_from(&toolbar.selections_menu);
377 self.toolbar.agent_review.merge_from(&toolbar.agent_review);
378 self.toolbar.code_actions.merge_from(&toolbar.code_actions);
379 }
380 if let Some(scrollbar) = &editor.scrollbar {
381 self.scrollbar
382 .show
383 .merge_from(&scrollbar.show.map(Into::into));
384 self.scrollbar.git_diff.merge_from(&scrollbar.git_diff);
385 self.scrollbar
386 .selected_text
387 .merge_from(&scrollbar.selected_text);
388 self.scrollbar
389 .selected_symbol
390 .merge_from(&scrollbar.selected_symbol);
391 self.scrollbar
392 .search_results
393 .merge_from(&scrollbar.search_results);
394 self.scrollbar
395 .diagnostics
396 .merge_from(&scrollbar.diagnostics);
397 self.scrollbar.cursors.merge_from(&scrollbar.cursors);
398 if let Some(axes) = &scrollbar.axes {
399 self.scrollbar.axes.horizontal.merge_from(&axes.horizontal);
400 self.scrollbar.axes.vertical.merge_from(&axes.vertical);
401 }
402 }
403 if let Some(minimap) = &editor.minimap {
404 self.minimap.show.merge_from(&minimap.show);
405 self.minimap.display_in.merge_from(&minimap.display_in);
406 self.minimap.thumb.merge_from(&minimap.thumb);
407 self.minimap.thumb_border.merge_from(&minimap.thumb_border);
408 self.minimap
409 .current_line_highlight
410 .merge_from(&minimap.current_line_highlight);
411 self.minimap
412 .max_width_columns
413 .merge_from(&minimap.max_width_columns);
414 }
415 if let Some(gutter) = &editor.gutter {
416 self.gutter
417 .min_line_number_digits
418 .merge_from(&gutter.min_line_number_digits);
419 self.gutter.line_numbers.merge_from(&gutter.line_numbers);
420 self.gutter.runnables.merge_from(&gutter.runnables);
421 self.gutter.breakpoints.merge_from(&gutter.breakpoints);
422 self.gutter.folds.merge_from(&gutter.folds);
423 }
424 if let Some(search) = &editor.search {
425 self.search.button.merge_from(&search.button);
426 self.search.whole_word.merge_from(&search.whole_word);
427 self.search
428 .case_sensitive
429 .merge_from(&search.case_sensitive);
430 self.search
431 .include_ignored
432 .merge_from(&search.include_ignored);
433 self.search.regex.merge_from(&search.regex);
434 }
435 if let Some(enabled) = editor.jupyter.as_ref().and_then(|jupyter| jupyter.enabled) {
436 self.jupyter.enabled = enabled;
437 }
438 if let Some(drag_and_drop_selection) = &editor.drag_and_drop_selection {
439 self.drag_and_drop_selection
440 .enabled
441 .merge_from(&drag_and_drop_selection.enabled);
442 self.drag_and_drop_selection
443 .delay
444 .merge_from(&drag_and_drop_selection.delay);
445 }
446 }
447
448 fn import_from_vscode(vscode: &VsCodeSettings, current: &mut SettingsContent) {
449 vscode.enum_setting(
450 "editor.cursorBlinking",
451 &mut current.editor.cursor_blink,
452 |s| match s {
453 "blink" | "phase" | "expand" | "smooth" => Some(true),
454 "solid" => Some(false),
455 _ => None,
456 },
457 );
458 vscode.enum_setting(
459 "editor.cursorStyle",
460 &mut current.editor.cursor_shape,
461 |s| match s {
462 "block" => Some(settings::CursorShape::Block),
463 "block-outline" => Some(settings::CursorShape::Hollow),
464 "line" | "line-thin" => Some(settings::CursorShape::Bar),
465 "underline" | "underline-thin" => Some(settings::CursorShape::Underline),
466 _ => None,
467 },
468 );
469
470 vscode.enum_setting(
471 "editor.renderLineHighlight",
472 &mut current.editor.current_line_highlight,
473 |s| match s {
474 "gutter" => Some(CurrentLineHighlight::Gutter),
475 "line" => Some(CurrentLineHighlight::Line),
476 "all" => Some(CurrentLineHighlight::All),
477 _ => None,
478 },
479 );
480
481 vscode.bool_setting(
482 "editor.selectionHighlight",
483 &mut current.editor.selection_highlight,
484 );
485 vscode.bool_setting(
486 "editor.roundedSelection",
487 &mut current.editor.rounded_selection,
488 );
489 vscode.bool_setting(
490 "editor.hover.enabled",
491 &mut current.editor.hover_popover_enabled,
492 );
493 vscode.u64_setting(
494 "editor.hover.delay",
495 &mut current.editor.hover_popover_delay,
496 );
497
498 let mut gutter = settings::GutterContent::default();
499 vscode.enum_setting(
500 "editor.showFoldingControls",
501 &mut gutter.folds,
502 |s| match s {
503 "always" | "mouseover" => Some(true),
504 "never" => Some(false),
505 _ => None,
506 },
507 );
508 vscode.enum_setting(
509 "editor.lineNumbers",
510 &mut gutter.line_numbers,
511 |s| match s {
512 "on" | "relative" => Some(true),
513 "off" => Some(false),
514 _ => None,
515 },
516 );
517 if let Some(old_gutter) = current.editor.gutter.as_mut() {
518 if gutter.folds.is_some() {
519 old_gutter.folds = gutter.folds
520 }
521 if gutter.line_numbers.is_some() {
522 old_gutter.line_numbers = gutter.line_numbers
523 }
524 } else if gutter != settings::GutterContent::default() {
525 current.editor.gutter = Some(gutter)
526 }
527 if let Some(b) = vscode.read_bool("editor.scrollBeyondLastLine") {
528 current.editor.scroll_beyond_last_line = Some(if b {
529 ScrollBeyondLastLine::OnePage
530 } else {
531 ScrollBeyondLastLine::Off
532 })
533 }
534
535 let mut scrollbar_axes = settings::ScrollbarAxesContent::default();
536 vscode.enum_setting(
537 "editor.scrollbar.horizontal",
538 &mut scrollbar_axes.horizontal,
539 |s| match s {
540 "auto" | "visible" => Some(true),
541 "hidden" => Some(false),
542 _ => None,
543 },
544 );
545 vscode.enum_setting(
546 "editor.scrollbar.vertical",
547 &mut scrollbar_axes.horizontal,
548 |s| match s {
549 "auto" | "visible" => Some(true),
550 "hidden" => Some(false),
551 _ => None,
552 },
553 );
554
555 if scrollbar_axes != settings::ScrollbarAxesContent::default() {
556 let scrollbar_settings = current.editor.scrollbar.get_or_insert_default();
557 let axes_settings = scrollbar_settings.axes.get_or_insert_default();
558
559 if let Some(vertical) = scrollbar_axes.vertical {
560 axes_settings.vertical = Some(vertical);
561 }
562 if let Some(horizontal) = scrollbar_axes.horizontal {
563 axes_settings.horizontal = Some(horizontal);
564 }
565 }
566
567 // TODO: check if this does the int->float conversion?
568 vscode.f32_setting(
569 "editor.cursorSurroundingLines",
570 &mut current.editor.vertical_scroll_margin,
571 );
572 vscode.f32_setting(
573 "editor.mouseWheelScrollSensitivity",
574 &mut current.editor.scroll_sensitivity,
575 );
576 vscode.f32_setting(
577 "editor.fastScrollSensitivity",
578 &mut current.editor.fast_scroll_sensitivity,
579 );
580 if Some("relative") == vscode.read_string("editor.lineNumbers") {
581 current.editor.relative_line_numbers = Some(true);
582 }
583
584 vscode.enum_setting(
585 "editor.find.seedSearchStringFromSelection",
586 &mut current.editor.seed_search_query_from_cursor,
587 |s| match s {
588 "always" => Some(SeedQuerySetting::Always),
589 "selection" => Some(SeedQuerySetting::Selection),
590 "never" => Some(SeedQuerySetting::Never),
591 _ => None,
592 },
593 );
594 vscode.bool_setting("search.smartCase", &mut current.editor.use_smartcase_search);
595 vscode.enum_setting(
596 "editor.multiCursorModifier",
597 &mut current.editor.multi_cursor_modifier,
598 |s| match s {
599 "ctrlCmd" => Some(MultiCursorModifier::CmdOrCtrl),
600 "alt" => Some(MultiCursorModifier::Alt),
601 _ => None,
602 },
603 );
604
605 vscode.bool_setting(
606 "editor.parameterHints.enabled",
607 &mut current.editor.auto_signature_help,
608 );
609 vscode.bool_setting(
610 "editor.parameterHints.enabled",
611 &mut current.editor.show_signature_help_after_edits,
612 );
613
614 if let Some(use_ignored) = vscode.read_bool("search.useIgnoreFiles") {
615 let search = current.editor.search.get_or_insert_default();
616 search.include_ignored = Some(use_ignored);
617 }
618
619 let mut minimap = settings::MinimapContent::default();
620 let minimap_enabled = vscode.read_bool("editor.minimap.enabled").unwrap_or(true);
621 let autohide = vscode.read_bool("editor.minimap.autohide");
622 let mut max_width_columns: Option<u32> = None;
623 vscode.u32_setting("editor.minimap.maxColumn", &mut max_width_columns);
624 if minimap_enabled {
625 if let Some(false) = autohide {
626 minimap.show = Some(ShowMinimap::Always);
627 } else {
628 minimap.show = Some(ShowMinimap::Auto);
629 }
630 } else {
631 minimap.show = Some(ShowMinimap::Never);
632 }
633 if let Some(max_width_columns) = max_width_columns {
634 minimap.max_width_columns = NonZeroU32::new(max_width_columns);
635 }
636
637 vscode.enum_setting(
638 "editor.minimap.showSlider",
639 &mut minimap.thumb,
640 |s| match s {
641 "always" => Some(MinimapThumb::Always),
642 "mouseover" => Some(MinimapThumb::Hover),
643 _ => None,
644 },
645 );
646
647 if minimap != settings::MinimapContent::default() {
648 current.editor.minimap = Some(minimap)
649 }
650 }
651}