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