Skip to repository content1189 lines · 32.4 KB · rust
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T03:31:22.566Z Public web read
NIP-34 coordinate
30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omegaMaintainersHidden in public view
References2 branches · 1 tag
Read-only clone
git clone https://openagents.com/git/tenant.openagents/omega.gitBrowse files
editor.rs
1use std::fmt::Display;
2use std::num;
3
4use collections::HashMap;
5use schemars::JsonSchema;
6use serde::{Deserialize, Serialize};
7use settings_macros::{MergeFrom, with_fallible_options};
8
9use crate::{
10 DelayMs, DiagnosticSeverityContent, ShowScrollbar, serialize_f32_with_two_decimal_places,
11};
12
13#[with_fallible_options]
14#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, MergeFrom)]
15pub struct EditorSettingsContent {
16 /// Whether the cursor blinks in the editor.
17 ///
18 /// Default: true
19 pub cursor_blink: Option<bool>,
20 /// Cursor shape for the default editor.
21 /// Can be "bar", "block", "underline", or "hollow".
22 ///
23 /// Default: bar
24 pub cursor_shape: Option<CursorShape>,
25 /// Determines how snippets are sorted relative to other completion items.
26 ///
27 /// Default: inline
28 pub snippet_sort_order: Option<SnippetSortOrder>,
29 /// How to highlight the current line in the editor.
30 ///
31 /// Default: all
32 pub current_line_highlight: Option<CurrentLineHighlight>,
33 /// Whether to highlight all occurrences of the selected text in an editor.
34 ///
35 /// Default: true
36 pub selection_highlight: Option<bool>,
37 /// Whether the text selection should have rounded corners.
38 ///
39 /// Default: true
40 pub rounded_selection: Option<bool>,
41 /// The debounce delay before querying highlights from the language
42 /// server based on the current cursor location.
43 ///
44 /// Default: 75
45 pub lsp_highlight_debounce: Option<DelayMs>,
46 /// Whether to show the informational hover box when moving the mouse
47 /// over symbols in the editor.
48 ///
49 /// Default: true
50 pub hover_popover_enabled: Option<bool>,
51 /// Time to wait in milliseconds before showing the informational hover box.
52 /// This delay also applies to auto signature help when `auto_signature_help` is enabled.
53 ///
54 /// Default: 300
55 pub hover_popover_delay: Option<DelayMs>,
56 /// Whether the hover popover sticks when the mouse moves toward it,
57 /// allowing interaction with its contents before it disappears.
58 ///
59 /// Default: true
60 pub hover_popover_sticky: Option<bool>,
61 /// Time to wait in milliseconds before hiding the hover popover
62 /// after the mouse moves away from the hover target.
63 /// Only applies when `hover_popover_sticky` is enabled.
64 ///
65 /// Default: 300
66 pub hover_popover_hiding_delay: Option<DelayMs>,
67 /// Toolbar related settings
68 pub toolbar: Option<ToolbarContent>,
69 /// Scrollbar related settings
70 pub scrollbar: Option<ScrollbarContent>,
71 /// Minimap related settings
72 pub minimap: Option<MinimapContent>,
73 /// Gutter related settings
74 pub gutter: Option<GutterContent>,
75 /// Whether the editor will scroll beyond the last line.
76 ///
77 /// Default: one_page
78 pub scroll_beyond_last_line: Option<ScrollBeyondLastLine>,
79 /// The number of lines to keep above/below the cursor when auto-scrolling.
80 ///
81 /// Default: 3.
82 #[serde(serialize_with = "crate::serialize_optional_f32_with_two_decimal_places")]
83 pub vertical_scroll_margin: Option<f32>,
84 /// Whether to scroll when clicking near the edge of the visible text area.
85 ///
86 /// Default: false
87 pub autoscroll_on_clicks: Option<bool>,
88 /// The number of characters to keep on either side when scrolling with the mouse.
89 ///
90 /// Default: 5.
91 #[serde(serialize_with = "crate::serialize_optional_f32_with_two_decimal_places")]
92 pub horizontal_scroll_margin: Option<f32>,
93 /// Scroll sensitivity multiplier. This multiplier is applied
94 /// to both the horizontal and vertical delta values while scrolling.
95 ///
96 /// Default: 1.0
97 #[serde(serialize_with = "crate::serialize_optional_f32_with_two_decimal_places")]
98 pub scroll_sensitivity: Option<f32>,
99 /// Whether to zoom the editor font size with the mouse wheel
100 /// while holding the primary modifier key (Cmd on macOS, Ctrl on other platforms).
101 ///
102 /// Default: false
103 pub mouse_wheel_zoom: Option<bool>,
104 /// Scroll sensitivity multiplier for fast scrolling. This multiplier is applied
105 /// to both the horizontal and vertical delta values while scrolling. Fast scrolling
106 /// happens when a user holds the alt or option key while scrolling.
107 ///
108 /// Default: 4.0
109 #[serde(serialize_with = "crate::serialize_optional_f32_with_two_decimal_places")]
110 pub fast_scroll_sensitivity: Option<f32>,
111 /// Settings for sticking scopes to the top of the editor.
112 ///
113 /// Default: sticky scroll is disabled
114 pub sticky_scroll: Option<StickyScrollContent>,
115 /// Whether the line numbers on editors gutter are relative or not.
116 /// When "enabled" shows relative number of buffer lines, when "wrapped" shows
117 /// relative number of display lines.
118 ///
119 /// Default: "disabled"
120 pub relative_line_numbers: Option<RelativeLineNumbers>,
121 /// When to populate a new search's query based on the text under the cursor.
122 ///
123 /// Default: always
124 pub seed_search_query_from_cursor: Option<SeedQuerySetting>,
125 pub use_smartcase_search: Option<bool>,
126 /// Determines the modifier to be used to add multiple cursors with the mouse. The open hover link mouse gestures will adapt such that it do not conflict with the multicursor modifier.
127 ///
128 /// Default: alt
129 pub multi_cursor_modifier: Option<MultiCursorModifier>,
130 /// Hide the values of variables in `private` files, as defined by the
131 /// private_files setting. This only changes the visual representation,
132 /// the values are still present in the file and can be selected / copied / pasted
133 ///
134 /// Default: false
135 pub redact_private_values: Option<bool>,
136
137 /// How many lines to expand the multibuffer excerpts by default
138 ///
139 /// Default: 3
140 pub expand_excerpt_lines: Option<u32>,
141
142 /// How many lines of context to provide in multibuffer excerpts by default
143 ///
144 /// Default: 2
145 pub excerpt_context_lines: Option<u32>,
146
147 /// Whether to enable middle-click paste on Linux
148 ///
149 /// Default: true
150 pub middle_click_paste: Option<bool>,
151
152 /// What to do when multibuffer is double clicked in some of its excerpts
153 /// (parts of singleton buffers).
154 ///
155 /// Default: select
156 pub double_click_in_multibuffer: Option<DoubleClickInMultibuffer>,
157 /// Whether the editor search results will loop
158 ///
159 /// Default: true
160 pub search_wrap: Option<bool>,
161
162 /// Defaults to use when opening a new buffer and project search items.
163 ///
164 /// Default: nothing is enabled
165 pub search: Option<SearchSettingsContent>,
166
167 /// Whether to automatically show a signature help pop-up or not.
168 ///
169 /// Default: false
170 pub auto_signature_help: Option<bool>,
171
172 /// Whether to show the signature help pop-up after completions or bracket pairs inserted.
173 ///
174 /// Default: false
175 pub show_signature_help_after_edits: Option<bool>,
176 /// The minimum APCA perceptual contrast to maintain when
177 /// rendering text over highlight backgrounds in the editor.
178 ///
179 /// Values range from 0 to 106. Set to 0 to disable adjustments.
180 /// Default: 45
181 #[schemars(range(min = 0, max = 106))]
182 pub minimum_contrast_for_highlights: Option<MinimumContrast>,
183
184 /// Whether to follow-up empty go to definition responses from the language server or not.
185 /// `FindAllReferences` allows to look up references of the same symbol instead.
186 /// `None` disables the fallback.
187 ///
188 /// Default: FindAllReferences
189 pub go_to_definition_fallback: Option<GoToDefinitionFallback>,
190
191 /// Where to show LSP results that can contain multiple locations
192 /// (Go to Definition, Go to Implementation, Find All References). A single
193 /// result always opens directly. Individual actions can override this with
194 /// their `open_results_in` argument.
195 ///
196 /// Default: multi_buffer
197 pub lsp_results_location: Option<OpenResultsIn>,
198
199 /// How to scroll the target into view when navigating to a definition or reference
200 /// (e.g. Go to Definition, Go to Type Definition, Find All References).
201 ///
202 /// Default: center
203 pub go_to_definition_scroll_strategy: Option<GoToDefinitionScrollStrategy>,
204
205 /// Jupyter REPL settings.
206 pub jupyter: Option<JupyterContent>,
207
208 /// Which level to use to filter out diagnostics displayed in the editor.
209 ///
210 /// Affects the editor rendering only, and does not interrupt
211 /// the functionality of diagnostics fetching and project diagnostics editor.
212 /// Which files containing diagnostic errors/warnings to mark in the tabs.
213 /// Diagnostics are only shown when file icons are also active.
214 ///
215 /// Shows all diagnostics if not specified.
216 ///
217 /// Default: warning
218 pub diagnostics_max_severity: Option<DiagnosticSeverityContent>,
219
220 /// Whether to show code action button at start of buffer line.
221 ///
222 /// Default: true
223 pub inline_code_actions: Option<bool>,
224
225 /// Drag and drop related settings
226 pub drag_and_drop_selection: Option<DragAndDropSelectionContent>,
227
228 /// Whether and how to display code lenses from language servers.
229 ///
230 /// Default: "off"
231 pub code_lens: Option<CodeLens>,
232
233 /// How to render LSP `textDocument/documentColor` colors in the editor.
234 ///
235 /// Default: [`DocumentColorsRenderMode::Inlay`]
236 pub lsp_document_colors: Option<DocumentColorsRenderMode>,
237 /// Whether to query and display LSP `textDocument/documentLink` links in the editor.
238 ///
239 /// Default: true
240 pub lsp_document_links: Option<bool>,
241 /// When to show the scrollbar in the completion menu.
242 /// This setting can take four values:
243 ///
244 /// 1. Show the scrollbar if there's important information or
245 /// follow the system's configured behavior
246 /// "auto"
247 /// 2. Match the system's configured behavior:
248 /// "system"
249 /// 3. Always show the scrollbar:
250 /// "always"
251 /// 4. Never show the scrollbar:
252 /// "never" (default)
253 pub completion_menu_scrollbar: Option<ShowScrollbar>,
254
255 /// Whether to align detail text in code completions context menus left or right.
256 ///
257 /// Default: left
258 pub completion_detail_alignment: Option<CompletionDetailAlignment>,
259
260 /// How to display the LSP item kind (function, method, variable, etc.)
261 /// of each entry in the completions menu.
262 ///
263 /// - "off": do not display item kinds (default).
264 /// - "symbol": display a single-letter badge, colorized based on the
265 /// active syntax theme.
266 ///
267 /// Default: off
268 pub completion_menu_item_kind: Option<CompletionMenuItemKind>,
269
270 /// How to display diffs in the editor.
271 ///
272 /// Default: split
273 pub diff_view_style: Option<DiffViewStyle>,
274
275 /// The minimum width (in em-widths) at which the split diff view is used.
276 /// When the editor is narrower than this, the diff view automatically
277 /// switches to unified mode and switches back when the editor is wide
278 /// enough. Set to 0 to disable automatic switching.
279 ///
280 /// Default: 100
281 pub minimum_split_diff_width: Option<f32>,
282}
283
284#[derive(
285 Debug,
286 Clone,
287 Copy,
288 Serialize,
289 Deserialize,
290 JsonSchema,
291 MergeFrom,
292 PartialEq,
293 Eq,
294 strum::VariantArray,
295 strum::VariantNames,
296)]
297#[serde(rename_all = "snake_case")]
298pub enum RelativeLineNumbers {
299 Disabled,
300 Enabled,
301 Wrapped,
302}
303
304#[derive(
305 Debug,
306 Default,
307 Clone,
308 Copy,
309 Serialize,
310 Deserialize,
311 JsonSchema,
312 MergeFrom,
313 PartialEq,
314 Eq,
315 strum::VariantArray,
316 strum::VariantNames,
317)]
318#[serde(rename_all = "snake_case")]
319pub enum CompletionDetailAlignment {
320 #[default]
321 Left,
322 Right,
323}
324
325#[derive(
326 Debug,
327 Default,
328 Clone,
329 Copy,
330 Serialize,
331 Deserialize,
332 JsonSchema,
333 MergeFrom,
334 PartialEq,
335 Eq,
336 strum::VariantArray,
337 strum::VariantNames,
338)]
339#[serde(rename_all = "snake_case")]
340pub enum CompletionMenuItemKind {
341 #[default]
342 Off,
343 Symbol,
344}
345
346impl RelativeLineNumbers {
347 pub fn enabled(&self) -> bool {
348 match self {
349 RelativeLineNumbers::Enabled | RelativeLineNumbers::Wrapped => true,
350 RelativeLineNumbers::Disabled => false,
351 }
352 }
353 pub fn wrapped(&self) -> bool {
354 match self {
355 RelativeLineNumbers::Enabled | RelativeLineNumbers::Disabled => false,
356 RelativeLineNumbers::Wrapped => true,
357 }
358 }
359}
360
361// Toolbar related settings
362#[with_fallible_options]
363#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq)]
364pub struct ToolbarContent {
365 /// Whether to display breadcrumbs in the editor toolbar.
366 ///
367 /// Default: true
368 pub breadcrumbs: Option<bool>,
369 /// Whether to display quick action buttons in the editor toolbar.
370 ///
371 /// Default: true
372 pub quick_actions: Option<bool>,
373 /// Whether to show the selections menu in the editor toolbar.
374 ///
375 /// Default: true
376 pub selections_menu: Option<bool>,
377 /// Whether to display Agent review buttons in the editor toolbar.
378 /// Only applicable while reviewing a file edited by the Agent.
379 ///
380 /// Default: true
381 pub agent_review: Option<bool>,
382 /// Whether to display code action buttons in the editor toolbar.
383 ///
384 /// Default: false
385 pub code_actions: Option<bool>,
386}
387
388/// Scrollbar related settings
389#[with_fallible_options]
390#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Default)]
391pub struct ScrollbarContent {
392 /// When to show the scrollbar in the editor.
393 ///
394 /// Default: auto
395 pub show: Option<ShowScrollbar>,
396 /// Whether to show git diff indicators in the scrollbar.
397 ///
398 /// Default: true
399 pub git_diff: Option<bool>,
400 /// Whether to show buffer search result indicators in the scrollbar.
401 ///
402 /// Default: true
403 pub search_results: Option<bool>,
404 /// Whether to show selected text occurrences in the scrollbar.
405 ///
406 /// Default: true
407 pub selected_text: Option<bool>,
408 /// Whether to show selected symbol occurrences in the scrollbar.
409 ///
410 /// Default: true
411 pub selected_symbol: Option<bool>,
412 /// Which diagnostic indicators to show in the scrollbar:
413 ///
414 /// Default: all
415 pub diagnostics: Option<ScrollbarDiagnostics>,
416 /// Whether to show cursor positions in the scrollbar.
417 ///
418 /// Default: true
419 pub cursors: Option<bool>,
420 /// Forcefully enable or disable the scrollbar for each axis
421 pub axes: Option<ScrollbarAxesContent>,
422}
423
424/// Sticky scroll related settings
425#[with_fallible_options]
426#[derive(Clone, Default, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq)]
427pub struct StickyScrollContent {
428 /// Whether sticky scroll is enabled.
429 ///
430 /// Default: false
431 pub enabled: Option<bool>,
432}
433
434/// Minimap related settings
435#[with_fallible_options]
436#[derive(Clone, Default, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq)]
437pub struct MinimapContent {
438 /// When to show the minimap in the editor.
439 ///
440 /// Default: never
441 pub show: Option<ShowMinimap>,
442
443 /// Where to show the minimap in the editor.
444 ///
445 /// Default: [`DisplayIn::ActiveEditor`]
446 pub display_in: Option<DisplayIn>,
447
448 /// When to show the minimap thumb.
449 ///
450 /// Default: always
451 pub thumb: Option<MinimapThumb>,
452
453 /// Defines the border style for the minimap's scrollbar thumb.
454 ///
455 /// Default: left_open
456 pub thumb_border: Option<MinimapThumbBorder>,
457
458 /// How to highlight the current line in the minimap.
459 ///
460 /// Default: inherits editor line highlights setting
461 pub current_line_highlight: Option<CurrentLineHighlight>,
462
463 /// Maximum number of columns to display in the minimap.
464 ///
465 /// Default: 80
466 pub max_width_columns: Option<num::NonZeroU32>,
467}
468
469/// Forcefully enable or disable the scrollbar for each axis
470#[with_fallible_options]
471#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Default)]
472pub struct ScrollbarAxesContent {
473 /// When false, forcefully disables the horizontal scrollbar. Otherwise, obey other settings.
474 ///
475 /// Default: true
476 pub horizontal: Option<bool>,
477
478 /// When false, forcefully disables the vertical scrollbar. Otherwise, obey other settings.
479 ///
480 /// Default: true
481 pub vertical: Option<bool>,
482}
483
484/// Gutter related settings
485#[with_fallible_options]
486#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq)]
487pub struct GutterContent {
488 /// Whether to show line numbers in the gutter.
489 ///
490 /// Default: true
491 pub line_numbers: Option<bool>,
492 /// Minimum number of characters to reserve space for in the gutter.
493 ///
494 /// Default: 4
495 pub min_line_number_digits: Option<usize>,
496 /// Whether to show runnable buttons in the gutter.
497 ///
498 /// Default: true
499 pub runnables: Option<bool>,
500 /// Whether to show breakpoints in the gutter.
501 ///
502 /// Default: true
503 pub breakpoints: Option<bool>,
504 /// Whether to show bookmarks in the gutter.
505 ///
506 /// Default: true
507 pub bookmarks: Option<bool>,
508 /// Whether to show fold buttons in the gutter.
509 ///
510 /// Default: true
511 pub folds: Option<bool>,
512}
513
514/// Whether to display code lenses from language servers above code elements.
515#[derive(
516 Copy,
517 Clone,
518 Debug,
519 Default,
520 Serialize,
521 Deserialize,
522 PartialEq,
523 Eq,
524 JsonSchema,
525 MergeFrom,
526 strum::VariantArray,
527 strum::VariantNames,
528)]
529#[serde(rename_all = "snake_case")]
530pub enum CodeLens {
531 /// Do not query and display code lenses.
532 #[default]
533 Off,
534 /// Display code lenses from language servers above code elements.
535 On,
536 /// Display code lenses in the code action menu.
537 Menu,
538}
539
540impl CodeLens {
541 pub fn enabled(&self) -> bool {
542 self != &Self::Off
543 }
544
545 pub fn inline(&self) -> bool {
546 *self == Self::On
547 }
548
549 pub fn show_in_menu(&self) -> bool {
550 *self == Self::Menu
551 }
552}
553
554/// How to render LSP `textDocument/documentColor` colors in the editor.
555#[derive(
556 Debug,
557 Clone,
558 Copy,
559 Default,
560 Serialize,
561 Deserialize,
562 JsonSchema,
563 MergeFrom,
564 PartialEq,
565 Eq,
566 strum::VariantArray,
567 strum::VariantNames,
568)]
569#[serde(rename_all = "snake_case")]
570pub enum DocumentColorsRenderMode {
571 /// Do not query and render document colors.
572 None,
573 /// Render document colors as inlay hints near the color text.
574 #[default]
575 Inlay,
576 /// Draw a border around the color text.
577 Border,
578 /// Draw a background behind the color text.
579 Background,
580}
581
582#[derive(
583 Copy,
584 Clone,
585 Debug,
586 Serialize,
587 Deserialize,
588 PartialEq,
589 Eq,
590 JsonSchema,
591 MergeFrom,
592 strum::VariantArray,
593 strum::VariantNames,
594)]
595#[serde(rename_all = "snake_case")]
596pub enum CurrentLineHighlight {
597 // Don't highlight the current line.
598 None,
599 // Highlight the gutter area.
600 Gutter,
601 // Highlight the editor area.
602 Line,
603 // Highlight the full line.
604 All,
605}
606
607/// When to populate a new search's query based on the text under the cursor.
608#[derive(
609 Copy,
610 Clone,
611 Debug,
612 Serialize,
613 Deserialize,
614 PartialEq,
615 Eq,
616 JsonSchema,
617 MergeFrom,
618 strum::VariantArray,
619 strum::VariantNames,
620)]
621#[serde(rename_all = "snake_case")]
622pub enum SeedQuerySetting {
623 /// Always populate the search query with the word under the cursor.
624 Always,
625 /// Only populate the search query when there is text selected.
626 Selection,
627 /// Never populate the search query
628 Never,
629}
630
631/// What to do when multibuffer is double clicked in some of its excerpts (parts of singleton buffers).
632#[derive(
633 Default,
634 Copy,
635 Clone,
636 Debug,
637 Serialize,
638 Deserialize,
639 PartialEq,
640 Eq,
641 JsonSchema,
642 MergeFrom,
643 strum::VariantArray,
644 strum::VariantNames,
645)]
646#[serde(rename_all = "snake_case")]
647pub enum DoubleClickInMultibuffer {
648 /// Behave as a regular buffer and select the whole word.
649 #[default]
650 Select,
651 /// Open the excerpt clicked as a new buffer in the new tab, if no `alt` modifier was pressed during double click.
652 /// Otherwise, behave as a regular buffer and select the whole word.
653 Open,
654}
655
656/// When to show the minimap thumb.
657///
658/// Default: always
659#[derive(
660 Copy,
661 Clone,
662 Debug,
663 Default,
664 Serialize,
665 Deserialize,
666 JsonSchema,
667 MergeFrom,
668 PartialEq,
669 Eq,
670 strum::VariantArray,
671 strum::VariantNames,
672)]
673#[serde(rename_all = "snake_case")]
674pub enum MinimapThumb {
675 /// Show the minimap thumb only when the mouse is hovering over the minimap.
676 Hover,
677 /// Always show the minimap thumb.
678 #[default]
679 Always,
680}
681
682/// Defines the border style for the minimap's scrollbar thumb.
683///
684/// Default: left_open
685#[derive(
686 Copy,
687 Clone,
688 Debug,
689 Default,
690 Serialize,
691 Deserialize,
692 JsonSchema,
693 MergeFrom,
694 PartialEq,
695 Eq,
696 strum::VariantArray,
697 strum::VariantNames,
698)]
699#[serde(rename_all = "snake_case")]
700pub enum MinimapThumbBorder {
701 /// Displays a border on all sides of the thumb.
702 Full,
703 /// Displays a border on all sides except the left side of the thumb.
704 #[default]
705 LeftOpen,
706 /// Displays a border on all sides except the right side of the thumb.
707 RightOpen,
708 /// Displays a border only on the left side of the thumb.
709 LeftOnly,
710 /// Displays the thumb without any border.
711 None,
712}
713
714/// Which diagnostic indicators to show in the scrollbar.
715///
716/// Default: all
717#[derive(
718 Copy,
719 Clone,
720 Debug,
721 Serialize,
722 Deserialize,
723 JsonSchema,
724 MergeFrom,
725 PartialEq,
726 Eq,
727 strum::VariantArray,
728 strum::VariantNames,
729)]
730#[serde(rename_all = "lowercase")]
731pub enum ScrollbarDiagnostics {
732 /// Show all diagnostic levels: hint, information, warnings, error.
733 All,
734 /// Show only the following diagnostic levels: information, warning, error.
735 Information,
736 /// Show only the following diagnostic levels: warning, error.
737 Warning,
738 /// Show only the following diagnostic level: error.
739 Error,
740 /// Do not show diagnostics.
741 None,
742}
743
744/// The key to use for adding multiple cursors
745///
746/// Default: alt
747#[derive(
748 Copy,
749 Clone,
750 Debug,
751 Serialize,
752 Deserialize,
753 JsonSchema,
754 MergeFrom,
755 PartialEq,
756 Eq,
757 strum::VariantArray,
758 strum::VariantNames,
759)]
760#[serde(rename_all = "snake_case")]
761pub enum MultiCursorModifier {
762 Alt,
763 #[serde(alias = "cmd", alias = "ctrl")]
764 CmdOrCtrl,
765}
766
767/// Whether the editor will scroll beyond the last line.
768///
769/// Default: one_page
770#[derive(
771 Copy,
772 Clone,
773 Debug,
774 Serialize,
775 Deserialize,
776 JsonSchema,
777 MergeFrom,
778 PartialEq,
779 Eq,
780 strum::VariantArray,
781 strum::VariantNames,
782)]
783#[serde(rename_all = "snake_case")]
784pub enum ScrollBeyondLastLine {
785 /// The editor will not scroll beyond the last line.
786 Off,
787
788 /// The editor will scroll beyond the last line by one page.
789 OnePage,
790
791 /// The editor will scroll beyond the last line by the same number of lines as vertical_scroll_margin.
792 VerticalScrollMargin,
793}
794
795/// The shape of a selection cursor.
796#[derive(
797 Copy,
798 Clone,
799 Debug,
800 Default,
801 Serialize,
802 Deserialize,
803 PartialEq,
804 Eq,
805 JsonSchema,
806 MergeFrom,
807 strum::VariantArray,
808 strum::VariantNames,
809)]
810#[serde(rename_all = "snake_case")]
811pub enum CursorShape {
812 /// A vertical bar
813 #[default]
814 Bar,
815 /// A block that surrounds the following character
816 Block,
817 /// An underline that runs along the following character
818 Underline,
819 /// A box drawn around the following character
820 Hollow,
821}
822
823/// What to do when go to definition yields no results.
824#[derive(
825 Copy,
826 Clone,
827 Debug,
828 Default,
829 Serialize,
830 Deserialize,
831 PartialEq,
832 Eq,
833 JsonSchema,
834 MergeFrom,
835 strum::VariantArray,
836 strum::VariantNames,
837)]
838#[serde(rename_all = "snake_case")]
839pub enum GoToDefinitionFallback {
840 /// Disables the fallback.
841 None,
842 /// Looks up references of the same symbol instead.
843 #[default]
844 FindAllReferences,
845}
846
847/// Where to show LSP results that can contain multiple locations.
848#[derive(
849 Copy,
850 Clone,
851 Debug,
852 Default,
853 Serialize,
854 Deserialize,
855 PartialEq,
856 Eq,
857 JsonSchema,
858 MergeFrom,
859 strum::VariantArray,
860 strum::VariantNames,
861)]
862#[serde(rename_all = "snake_case")]
863pub enum OpenResultsIn {
864 /// Open the results in a multibuffer.
865 #[default]
866 MultiBuffer,
867 /// Open the results in a filterable picker.
868 Picker,
869}
870
871/// How to scroll the target into view when navigating to a definition or reference.
872///
873/// Default: center
874#[derive(
875 Copy,
876 Clone,
877 Debug,
878 Default,
879 Serialize,
880 Deserialize,
881 PartialEq,
882 Eq,
883 JsonSchema,
884 MergeFrom,
885 strum::VariantArray,
886 strum::VariantNames,
887)]
888#[serde(rename_all = "snake_case")]
889pub enum GoToDefinitionScrollStrategy {
890 /// Vertically center the target in the viewport.
891 #[default]
892 Center,
893 /// Scroll the minimum amount needed to make the target visible.
894 Minimum,
895 /// Scroll so the target appears near the top of the viewport.
896 Top,
897 /// Preserve the cursor's vertical position within the viewport, falling
898 /// back to centering when the cursor is offscreen.
899 Preserve,
900}
901
902/// Determines how snippets are sorted relative to other completion items.
903///
904/// Default: inline
905#[derive(
906 Copy,
907 Clone,
908 Debug,
909 Default,
910 Serialize,
911 Deserialize,
912 PartialEq,
913 Eq,
914 JsonSchema,
915 MergeFrom,
916 strum::VariantArray,
917 strum::VariantNames,
918)]
919#[serde(rename_all = "snake_case")]
920pub enum SnippetSortOrder {
921 /// Place snippets at the top of the completion list
922 Top,
923 /// Sort snippets normally using the default comparison logic
924 #[default]
925 Inline,
926 /// Place snippets at the bottom of the completion list
927 Bottom,
928 /// Do not show snippets in the completion list
929 None,
930}
931
932/// How to display diffs in the editor.
933///
934/// Default: unified
935#[derive(
936 Copy,
937 Clone,
938 Debug,
939 Default,
940 PartialEq,
941 Eq,
942 Serialize,
943 Deserialize,
944 JsonSchema,
945 MergeFrom,
946 strum::Display,
947 strum::EnumIter,
948 strum::VariantArray,
949 strum::VariantNames,
950)]
951#[serde(rename_all = "snake_case")]
952pub enum DiffViewStyle {
953 /// Show diffs in a single unified view.
954 Unified,
955 /// Show diffs in a split view.
956 #[default]
957 Split,
958}
959
960/// Default options for buffer and project search items.
961#[with_fallible_options]
962#[derive(Clone, Default, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq)]
963pub struct SearchSettingsContent {
964 /// Whether to show the project search button in the status bar.
965 pub button: Option<bool>,
966 /// Whether to only match on whole words.
967 pub whole_word: Option<bool>,
968 /// Whether to match case sensitively.
969 pub case_sensitive: Option<bool>,
970 /// Whether to include gitignored files in search results.
971 pub include_ignored: Option<bool>,
972 /// Whether to interpret the search query as a regular expression.
973 pub regex: Option<bool>,
974 /// Whether to center the cursor on each search match when navigating.
975 pub center_on_match: Option<bool>,
976}
977
978#[with_fallible_options]
979#[derive(Default, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema, MergeFrom)]
980#[serde(rename_all = "snake_case")]
981pub struct JupyterContent {
982 /// Whether the Jupyter feature is enabled.
983 ///
984 /// Default: true
985 pub enabled: Option<bool>,
986
987 /// Default kernels to select for each language.
988 ///
989 /// Default: `{}`
990 pub kernel_selections: Option<HashMap<String, String>>,
991}
992
993/// Whether to allow drag and drop text selection in buffer.
994#[with_fallible_options]
995#[derive(Clone, Default, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq)]
996pub struct DragAndDropSelectionContent {
997 /// When true, enables drag and drop text selection in buffer.
998 ///
999 /// Default: true
1000 pub enabled: Option<bool>,
1001
1002 /// The delay in milliseconds that must elapse before drag and drop is allowed. Otherwise, a new text selection is created.
1003 ///
1004 /// Default: 300
1005 pub delay: Option<DelayMs>,
1006}
1007
1008/// When to show the minimap in the editor.
1009///
1010/// Default: never
1011#[derive(
1012 Copy,
1013 Clone,
1014 Debug,
1015 Default,
1016 Serialize,
1017 Deserialize,
1018 JsonSchema,
1019 MergeFrom,
1020 PartialEq,
1021 Eq,
1022 strum::VariantArray,
1023 strum::VariantNames,
1024)]
1025#[serde(rename_all = "snake_case")]
1026pub enum ShowMinimap {
1027 /// Follow the visibility of the scrollbar.
1028 Auto,
1029 /// Always show the minimap.
1030 Always,
1031 /// Never show the minimap.
1032 #[default]
1033 Never,
1034}
1035
1036/// Where to show the minimap in the editor.
1037///
1038/// Default: all_editors
1039#[derive(
1040 Copy,
1041 Clone,
1042 Debug,
1043 Default,
1044 Serialize,
1045 Deserialize,
1046 JsonSchema,
1047 MergeFrom,
1048 PartialEq,
1049 Eq,
1050 strum::VariantArray,
1051 strum::VariantNames,
1052)]
1053#[serde(rename_all = "snake_case")]
1054pub enum DisplayIn {
1055 /// Show on all open editors.
1056 AllEditors,
1057 /// Show the minimap on the active editor only.
1058 #[default]
1059 ActiveEditor,
1060}
1061
1062/// Minimum APCA perceptual contrast for text over highlight backgrounds.
1063///
1064/// Valid range: 0.0 to 106.0
1065/// Default: 45.0
1066#[derive(
1067 Clone,
1068 Copy,
1069 Debug,
1070 Serialize,
1071 Deserialize,
1072 JsonSchema,
1073 MergeFrom,
1074 PartialEq,
1075 PartialOrd,
1076 derive_more::FromStr,
1077)]
1078#[serde(transparent)]
1079pub struct MinimumContrast(
1080 #[serde(serialize_with = "crate::serialize_f32_with_two_decimal_places")] pub f32,
1081);
1082
1083impl Display for MinimumContrast {
1084 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1085 write!(f, "{:.1}", self.0)
1086 }
1087}
1088
1089impl From<f32> for MinimumContrast {
1090 fn from(x: f32) -> Self {
1091 Self(x)
1092 }
1093}
1094
1095/// Opacity of the inactive panes. 0 means transparent, 1 means opaque.
1096///
1097/// Valid range: 0.0 to 1.0
1098/// Default: 1.0
1099#[derive(
1100 Clone,
1101 Copy,
1102 Debug,
1103 Serialize,
1104 Deserialize,
1105 JsonSchema,
1106 MergeFrom,
1107 PartialEq,
1108 PartialOrd,
1109 derive_more::FromStr,
1110)]
1111#[serde(transparent)]
1112pub struct InactiveOpacity(
1113 #[serde(serialize_with = "serialize_f32_with_two_decimal_places")] pub f32,
1114);
1115
1116impl Display for InactiveOpacity {
1117 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1118 write!(f, "{:.1}", self.0)
1119 }
1120}
1121
1122impl From<f32> for InactiveOpacity {
1123 fn from(x: f32) -> Self {
1124 Self(x)
1125 }
1126}
1127
1128/// Centered layout related setting (left/right).
1129///
1130/// Valid range: 0.0 to 0.4
1131/// Default: 2.0
1132#[derive(
1133 Clone,
1134 Copy,
1135 Debug,
1136 Serialize,
1137 Deserialize,
1138 MergeFrom,
1139 PartialEq,
1140 PartialOrd,
1141 derive_more::FromStr,
1142)]
1143#[serde(transparent)]
1144pub struct CenteredPaddingSettings(
1145 #[serde(serialize_with = "serialize_f32_with_two_decimal_places")] pub f32,
1146);
1147
1148impl CenteredPaddingSettings {
1149 pub const MIN_PADDING: f32 = 0.0;
1150 // This is an f64 so serde_json can give a type hint without random numbers in the back
1151 pub const DEFAULT_PADDING: f64 = 0.2;
1152 pub const MAX_PADDING: f32 = 0.4;
1153}
1154
1155impl Display for CenteredPaddingSettings {
1156 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1157 write!(f, "{:.2}", self.0)
1158 }
1159}
1160
1161impl From<f32> for CenteredPaddingSettings {
1162 fn from(x: f32) -> Self {
1163 Self(x)
1164 }
1165}
1166
1167impl Default for CenteredPaddingSettings {
1168 fn default() -> Self {
1169 Self(Self::DEFAULT_PADDING as f32)
1170 }
1171}
1172
1173impl schemars::JsonSchema for CenteredPaddingSettings {
1174 fn schema_name() -> std::borrow::Cow<'static, str> {
1175 "CenteredPaddingSettings".into()
1176 }
1177
1178 fn json_schema(_: &mut schemars::SchemaGenerator) -> schemars::Schema {
1179 use schemars::json_schema;
1180 json_schema!({
1181 "type": "number",
1182 "minimum": Self::MIN_PADDING,
1183 "maximum": Self::MAX_PADDING,
1184 "default": Self::DEFAULT_PADDING,
1185 "description": "Centered layout related setting (left/right)."
1186 })
1187 }
1188}
1189