1use std::fmt::Display;
2use std::num;
3
4use collections::HashMap;
5use schemars::JsonSchema;
6use serde::{Deserialize, Serialize};
7use serde_with::skip_serializing_none;
8use settings_macros::MergeFrom;
9
10use crate::{DelayMs, DiagnosticSeverityContent, ShowScrollbar};
11
12#[skip_serializing_none]
13#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, MergeFrom)]
14pub struct EditorSettingsContent {
15 /// Whether the cursor blinks in the editor.
16 ///
17 /// Default: true
18 pub cursor_blink: Option<bool>,
19 /// Cursor shape for the default editor.
20 /// Can be "bar", "block", "underline", or "hollow".
21 ///
22 /// Default: bar
23 pub cursor_shape: Option<CursorShape>,
24 /// Determines when the mouse cursor should be hidden in an editor or input box.
25 ///
26 /// Default: on_typing_and_movement
27 pub hide_mouse: Option<HideMouseMode>,
28 /// Determines how snippets are sorted relative to other completion items.
29 ///
30 /// Default: inline
31 pub snippet_sort_order: Option<SnippetSortOrder>,
32 /// How to highlight the current line in the editor.
33 ///
34 /// Default: all
35 pub current_line_highlight: Option<CurrentLineHighlight>,
36 /// Whether to highlight all occurrences of the selected text in an editor.
37 ///
38 /// Default: true
39 pub selection_highlight: Option<bool>,
40 /// Whether the text selection should have rounded corners.
41 ///
42 /// Default: true
43 pub rounded_selection: Option<bool>,
44 /// The debounce delay before querying highlights from the language
45 /// server based on the current cursor location.
46 ///
47 /// Default: 75
48 pub lsp_highlight_debounce: Option<DelayMs>,
49 /// Whether to show the informational hover box when moving the mouse
50 /// over symbols in the editor.
51 ///
52 /// Default: true
53 pub hover_popover_enabled: Option<bool>,
54 /// Time to wait in milliseconds before showing the informational hover box.
55 ///
56 /// Default: 300
57 pub hover_popover_delay: Option<DelayMs>,
58 /// Toolbar related settings
59 pub toolbar: Option<ToolbarContent>,
60 /// Scrollbar related settings
61 pub scrollbar: Option<ScrollbarContent>,
62 /// Minimap related settings
63 pub minimap: Option<MinimapContent>,
64 /// Gutter related settings
65 pub gutter: Option<GutterContent>,
66 /// Whether the editor will scroll beyond the last line.
67 ///
68 /// Default: one_page
69 pub scroll_beyond_last_line: Option<ScrollBeyondLastLine>,
70 /// The number of lines to keep above/below the cursor when auto-scrolling.
71 ///
72 /// Default: 3.
73 pub vertical_scroll_margin: Option<f32>,
74 /// Whether to scroll when clicking near the edge of the visible text area.
75 ///
76 /// Default: false
77 pub autoscroll_on_clicks: Option<bool>,
78 /// The number of characters to keep on either side when scrolling with the mouse.
79 ///
80 /// Default: 5.
81 pub horizontal_scroll_margin: Option<f32>,
82 /// Scroll sensitivity multiplier. This multiplier is applied
83 /// to both the horizontal and vertical delta values while scrolling.
84 ///
85 /// Default: 1.0
86 pub scroll_sensitivity: Option<f32>,
87 /// Scroll sensitivity multiplier for fast scrolling. This multiplier is applied
88 /// to both the horizontal and vertical delta values while scrolling. Fast scrolling
89 /// happens when a user holds the alt or option key while scrolling.
90 ///
91 /// Default: 4.0
92 pub fast_scroll_sensitivity: Option<f32>,
93 /// Whether the line numbers on editors gutter are relative or not.
94 ///
95 /// Default: false
96 pub relative_line_numbers: Option<bool>,
97 /// Whether to show relative line numbers for wrapped lines (visual lines) rather than just buffer lines.
98 ///
99 /// Default: false
100 pub relative_line_numbers_for_wrapped_lines: Option<bool>,
101 /// When to populate a new search's query based on the text under the cursor.
102 ///
103 /// Default: always
104 pub seed_search_query_from_cursor: Option<SeedQuerySetting>,
105 pub use_smartcase_search: Option<bool>,
106 /// 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.
107 ///
108 /// Default: alt
109 pub multi_cursor_modifier: Option<MultiCursorModifier>,
110 /// Hide the values of variables in `private` files, as defined by the
111 /// private_files setting. This only changes the visual representation,
112 /// the values are still present in the file and can be selected / copied / pasted
113 ///
114 /// Default: false
115 pub redact_private_values: Option<bool>,
116
117 /// How many lines to expand the multibuffer excerpts by default
118 ///
119 /// Default: 3
120 pub expand_excerpt_lines: Option<u32>,
121
122 /// How many lines of context to provide in multibuffer excerpts by default
123 ///
124 /// Default: 2
125 pub excerpt_context_lines: Option<u32>,
126
127 /// Whether to enable middle-click paste on Linux
128 ///
129 /// Default: true
130 pub middle_click_paste: Option<bool>,
131
132 /// What to do when multibuffer is double clicked in some of its excerpts
133 /// (parts of singleton buffers).
134 ///
135 /// Default: select
136 pub double_click_in_multibuffer: Option<DoubleClickInMultibuffer>,
137 /// Whether the editor search results will loop
138 ///
139 /// Default: true
140 pub search_wrap: Option<bool>,
141
142 /// Defaults to use when opening a new buffer and project search items.
143 ///
144 /// Default: nothing is enabled
145 pub search: Option<SearchSettingsContent>,
146
147 /// Whether to automatically show a signature help pop-up or not.
148 ///
149 /// Default: false
150 pub auto_signature_help: Option<bool>,
151
152 /// Whether to show the signature help pop-up after completions or bracket pairs inserted.
153 ///
154 /// Default: false
155 pub show_signature_help_after_edits: Option<bool>,
156 /// The minimum APCA perceptual contrast to maintain when
157 /// rendering text over highlight backgrounds in the editor.
158 ///
159 /// Values range from 0 to 106. Set to 0 to disable adjustments.
160 /// Default: 45
161 #[schemars(range(min = 0, max = 106))]
162 pub minimum_contrast_for_highlights: Option<MinimumContrast>,
163
164 /// Whether to follow-up empty go to definition responses from the language server or not.
165 /// `FindAllReferences` allows to look up references of the same symbol instead.
166 /// `None` disables the fallback.
167 ///
168 /// Default: FindAllReferences
169 pub go_to_definition_fallback: Option<GoToDefinitionFallback>,
170
171 /// Jupyter REPL settings.
172 pub jupyter: Option<JupyterContent>,
173
174 /// Which level to use to filter out diagnostics displayed in the editor.
175 ///
176 /// Affects the editor rendering only, and does not interrupt
177 /// the functionality of diagnostics fetching and project diagnostics editor.
178 /// Which files containing diagnostic errors/warnings to mark in the tabs.
179 /// Diagnostics are only shown when file icons are also active.
180 ///
181 /// Shows all diagnostics if not specified.
182 ///
183 /// Default: warning
184 pub diagnostics_max_severity: Option<DiagnosticSeverityContent>,
185
186 /// Whether to show code action button at start of buffer line.
187 ///
188 /// Default: true
189 pub inline_code_actions: Option<bool>,
190
191 /// Drag and drop related settings
192 pub drag_and_drop_selection: Option<DragAndDropSelectionContent>,
193
194 /// How to render LSP `textDocument/documentColor` colors in the editor.
195 ///
196 /// Default: [`DocumentColorsRenderMode::Inlay`]
197 pub lsp_document_colors: Option<DocumentColorsRenderMode>,
198}
199
200// Toolbar related settings
201#[skip_serializing_none]
202#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq)]
203pub struct ToolbarContent {
204 /// Whether to display breadcrumbs in the editor toolbar.
205 ///
206 /// Default: true
207 pub breadcrumbs: Option<bool>,
208 /// Whether to display quick action buttons in the editor toolbar.
209 ///
210 /// Default: true
211 pub quick_actions: Option<bool>,
212 /// Whether to show the selections menu in the editor toolbar.
213 ///
214 /// Default: true
215 pub selections_menu: Option<bool>,
216 /// Whether to display Agent review buttons in the editor toolbar.
217 /// Only applicable while reviewing a file edited by the Agent.
218 ///
219 /// Default: true
220 pub agent_review: Option<bool>,
221 /// Whether to display code action buttons in the editor toolbar.
222 ///
223 /// Default: false
224 pub code_actions: Option<bool>,
225}
226
227/// Scrollbar related settings
228#[skip_serializing_none]
229#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Default)]
230pub struct ScrollbarContent {
231 /// When to show the scrollbar in the editor.
232 ///
233 /// Default: auto
234 pub show: Option<ShowScrollbar>,
235 /// Whether to show git diff indicators in the scrollbar.
236 ///
237 /// Default: true
238 pub git_diff: Option<bool>,
239 /// Whether to show buffer search result indicators in the scrollbar.
240 ///
241 /// Default: true
242 pub search_results: Option<bool>,
243 /// Whether to show selected text occurrences in the scrollbar.
244 ///
245 /// Default: true
246 pub selected_text: Option<bool>,
247 /// Whether to show selected symbol occurrences in the scrollbar.
248 ///
249 /// Default: true
250 pub selected_symbol: Option<bool>,
251 /// Which diagnostic indicators to show in the scrollbar:
252 ///
253 /// Default: all
254 pub diagnostics: Option<ScrollbarDiagnostics>,
255 /// Whether to show cursor positions in the scrollbar.
256 ///
257 /// Default: true
258 pub cursors: Option<bool>,
259 /// Forcefully enable or disable the scrollbar for each axis
260 pub axes: Option<ScrollbarAxesContent>,
261}
262
263/// Minimap related settings
264#[skip_serializing_none]
265#[derive(Clone, Default, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq)]
266pub struct MinimapContent {
267 /// When to show the minimap in the editor.
268 ///
269 /// Default: never
270 pub show: Option<ShowMinimap>,
271
272 /// Where to show the minimap in the editor.
273 ///
274 /// Default: [`DisplayIn::ActiveEditor`]
275 pub display_in: Option<DisplayIn>,
276
277 /// When to show the minimap thumb.
278 ///
279 /// Default: always
280 pub thumb: Option<MinimapThumb>,
281
282 /// Defines the border style for the minimap's scrollbar thumb.
283 ///
284 /// Default: left_open
285 pub thumb_border: Option<MinimapThumbBorder>,
286
287 /// How to highlight the current line in the minimap.
288 ///
289 /// Default: inherits editor line highlights setting
290 pub current_line_highlight: Option<CurrentLineHighlight>,
291
292 /// Maximum number of columns to display in the minimap.
293 ///
294 /// Default: 80
295 pub max_width_columns: Option<num::NonZeroU32>,
296}
297
298/// Forcefully enable or disable the scrollbar for each axis
299#[skip_serializing_none]
300#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Default)]
301pub struct ScrollbarAxesContent {
302 /// When false, forcefully disables the horizontal scrollbar. Otherwise, obey other settings.
303 ///
304 /// Default: true
305 pub horizontal: Option<bool>,
306
307 /// When false, forcefully disables the vertical scrollbar. Otherwise, obey other settings.
308 ///
309 /// Default: true
310 pub vertical: Option<bool>,
311}
312
313/// Gutter related settings
314#[skip_serializing_none]
315#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq)]
316pub struct GutterContent {
317 /// Whether to show line numbers in the gutter.
318 ///
319 /// Default: true
320 pub line_numbers: Option<bool>,
321 /// Minimum number of characters to reserve space for in the gutter.
322 ///
323 /// Default: 4
324 pub min_line_number_digits: Option<usize>,
325 /// Whether to show runnable buttons in the gutter.
326 ///
327 /// Default: true
328 pub runnables: Option<bool>,
329 /// Whether to show breakpoints in the gutter.
330 ///
331 /// Default: true
332 pub breakpoints: Option<bool>,
333 /// Whether to show fold buttons in the gutter.
334 ///
335 /// Default: true
336 pub folds: Option<bool>,
337}
338
339/// How to render LSP `textDocument/documentColor` colors in the editor.
340#[derive(
341 Copy,
342 Clone,
343 Debug,
344 Default,
345 Serialize,
346 Deserialize,
347 PartialEq,
348 Eq,
349 JsonSchema,
350 MergeFrom,
351 strum::VariantArray,
352 strum::VariantNames,
353)]
354#[serde(rename_all = "snake_case")]
355pub enum DocumentColorsRenderMode {
356 /// Do not query and render document colors.
357 None,
358 /// Render document colors as inlay hints near the color text.
359 #[default]
360 Inlay,
361 /// Draw a border around the color text.
362 Border,
363 /// Draw a background behind the color text.
364 Background,
365}
366
367#[derive(
368 Copy,
369 Clone,
370 Debug,
371 Serialize,
372 Deserialize,
373 PartialEq,
374 Eq,
375 JsonSchema,
376 MergeFrom,
377 strum::VariantArray,
378 strum::VariantNames,
379)]
380#[serde(rename_all = "snake_case")]
381pub enum CurrentLineHighlight {
382 // Don't highlight the current line.
383 None,
384 // Highlight the gutter area.
385 Gutter,
386 // Highlight the editor area.
387 Line,
388 // Highlight the full line.
389 All,
390}
391
392/// When to populate a new search's query based on the text under the cursor.
393#[derive(
394 Copy,
395 Clone,
396 Debug,
397 Serialize,
398 Deserialize,
399 PartialEq,
400 Eq,
401 JsonSchema,
402 MergeFrom,
403 strum::VariantArray,
404 strum::VariantNames,
405)]
406#[serde(rename_all = "snake_case")]
407pub enum SeedQuerySetting {
408 /// Always populate the search query with the word under the cursor.
409 Always,
410 /// Only populate the search query when there is text selected.
411 Selection,
412 /// Never populate the search query
413 Never,
414}
415
416/// What to do when multibuffer is double clicked in some of its excerpts (parts of singleton buffers).
417#[derive(
418 Default,
419 Copy,
420 Clone,
421 Debug,
422 Serialize,
423 Deserialize,
424 PartialEq,
425 Eq,
426 JsonSchema,
427 MergeFrom,
428 strum::VariantArray,
429 strum::VariantNames,
430)]
431#[serde(rename_all = "snake_case")]
432pub enum DoubleClickInMultibuffer {
433 /// Behave as a regular buffer and select the whole word.
434 #[default]
435 Select,
436 /// Open the excerpt clicked as a new buffer in the new tab, if no `alt` modifier was pressed during double click.
437 /// Otherwise, behave as a regular buffer and select the whole word.
438 Open,
439}
440
441/// When to show the minimap thumb.
442///
443/// Default: always
444#[derive(
445 Copy,
446 Clone,
447 Debug,
448 Default,
449 Serialize,
450 Deserialize,
451 JsonSchema,
452 MergeFrom,
453 PartialEq,
454 Eq,
455 strum::VariantArray,
456 strum::VariantNames,
457)]
458#[serde(rename_all = "snake_case")]
459pub enum MinimapThumb {
460 /// Show the minimap thumb only when the mouse is hovering over the minimap.
461 Hover,
462 /// Always show the minimap thumb.
463 #[default]
464 Always,
465}
466
467/// Defines the border style for the minimap's scrollbar thumb.
468///
469/// Default: left_open
470#[derive(
471 Copy,
472 Clone,
473 Debug,
474 Default,
475 Serialize,
476 Deserialize,
477 JsonSchema,
478 MergeFrom,
479 PartialEq,
480 Eq,
481 strum::VariantArray,
482 strum::VariantNames,
483)]
484#[serde(rename_all = "snake_case")]
485pub enum MinimapThumbBorder {
486 /// Displays a border on all sides of the thumb.
487 Full,
488 /// Displays a border on all sides except the left side of the thumb.
489 #[default]
490 LeftOpen,
491 /// Displays a border on all sides except the right side of the thumb.
492 RightOpen,
493 /// Displays a border only on the left side of the thumb.
494 LeftOnly,
495 /// Displays the thumb without any border.
496 None,
497}
498
499/// Which diagnostic indicators to show in the scrollbar.
500///
501/// Default: all
502#[derive(
503 Copy,
504 Clone,
505 Debug,
506 Serialize,
507 Deserialize,
508 JsonSchema,
509 MergeFrom,
510 PartialEq,
511 Eq,
512 strum::VariantArray,
513 strum::VariantNames,
514)]
515#[serde(rename_all = "lowercase")]
516pub enum ScrollbarDiagnostics {
517 /// Show all diagnostic levels: hint, information, warnings, error.
518 All,
519 /// Show only the following diagnostic levels: information, warning, error.
520 Information,
521 /// Show only the following diagnostic levels: warning, error.
522 Warning,
523 /// Show only the following diagnostic level: error.
524 Error,
525 /// Do not show diagnostics.
526 None,
527}
528
529/// The key to use for adding multiple cursors
530///
531/// Default: alt
532#[derive(
533 Copy,
534 Clone,
535 Debug,
536 Serialize,
537 Deserialize,
538 JsonSchema,
539 MergeFrom,
540 PartialEq,
541 Eq,
542 strum::VariantArray,
543 strum::VariantNames,
544)]
545#[serde(rename_all = "snake_case")]
546pub enum MultiCursorModifier {
547 Alt,
548 #[serde(alias = "cmd", alias = "ctrl")]
549 CmdOrCtrl,
550}
551
552/// Whether the editor will scroll beyond the last line.
553///
554/// Default: one_page
555#[derive(
556 Copy,
557 Clone,
558 Debug,
559 Serialize,
560 Deserialize,
561 JsonSchema,
562 MergeFrom,
563 PartialEq,
564 Eq,
565 strum::VariantArray,
566 strum::VariantNames,
567)]
568#[serde(rename_all = "snake_case")]
569pub enum ScrollBeyondLastLine {
570 /// The editor will not scroll beyond the last line.
571 Off,
572
573 /// The editor will scroll beyond the last line by one page.
574 OnePage,
575
576 /// The editor will scroll beyond the last line by the same number of lines as vertical_scroll_margin.
577 VerticalScrollMargin,
578}
579
580/// The shape of a selection cursor.
581#[derive(
582 Copy,
583 Clone,
584 Debug,
585 Default,
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 CursorShape {
597 /// A vertical bar
598 #[default]
599 Bar,
600 /// A block that surrounds the following character
601 Block,
602 /// An underline that runs along the following character
603 Underline,
604 /// A box drawn around the following character
605 Hollow,
606}
607
608/// What to do when go to definition yields no results.
609#[derive(
610 Copy,
611 Clone,
612 Debug,
613 Default,
614 Serialize,
615 Deserialize,
616 PartialEq,
617 Eq,
618 JsonSchema,
619 MergeFrom,
620 strum::VariantArray,
621 strum::VariantNames,
622)]
623#[serde(rename_all = "snake_case")]
624pub enum GoToDefinitionFallback {
625 /// Disables the fallback.
626 None,
627 /// Looks up references of the same symbol instead.
628 #[default]
629 FindAllReferences,
630}
631
632/// Determines when the mouse cursor should be hidden in an editor or input box.
633///
634/// Default: on_typing_and_movement
635#[derive(
636 Copy,
637 Clone,
638 Debug,
639 Default,
640 Serialize,
641 Deserialize,
642 PartialEq,
643 Eq,
644 JsonSchema,
645 MergeFrom,
646 strum::VariantArray,
647 strum::VariantNames,
648)]
649#[serde(rename_all = "snake_case")]
650pub enum HideMouseMode {
651 /// Never hide the mouse cursor
652 Never,
653 /// Hide only when typing
654 OnTyping,
655 /// Hide on both typing and cursor movement
656 #[default]
657 OnTypingAndMovement,
658}
659
660/// Determines how snippets are sorted relative to other completion items.
661///
662/// Default: inline
663#[derive(
664 Copy,
665 Clone,
666 Debug,
667 Default,
668 Serialize,
669 Deserialize,
670 PartialEq,
671 Eq,
672 JsonSchema,
673 MergeFrom,
674 strum::VariantArray,
675 strum::VariantNames,
676)]
677#[serde(rename_all = "snake_case")]
678pub enum SnippetSortOrder {
679 /// Place snippets at the top of the completion list
680 Top,
681 /// Sort snippets normally using the default comparison logic
682 #[default]
683 Inline,
684 /// Place snippets at the bottom of the completion list
685 Bottom,
686 /// Do not show snippets in the completion list
687 None,
688}
689
690/// Default options for buffer and project search items.
691#[skip_serializing_none]
692#[derive(Clone, Default, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq)]
693pub struct SearchSettingsContent {
694 /// Whether to show the project search button in the status bar.
695 pub button: Option<bool>,
696 pub whole_word: Option<bool>,
697 pub case_sensitive: Option<bool>,
698 pub include_ignored: Option<bool>,
699 pub regex: Option<bool>,
700}
701
702#[skip_serializing_none]
703#[derive(Default, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema, MergeFrom)]
704#[serde(rename_all = "snake_case")]
705pub struct JupyterContent {
706 /// Whether the Jupyter feature is enabled.
707 ///
708 /// Default: true
709 pub enabled: Option<bool>,
710
711 /// Default kernels to select for each language.
712 ///
713 /// Default: `{}`
714 pub kernel_selections: Option<HashMap<String, String>>,
715}
716
717/// Whether to allow drag and drop text selection in buffer.
718#[skip_serializing_none]
719#[derive(Clone, Default, Debug, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq)]
720pub struct DragAndDropSelectionContent {
721 /// When true, enables drag and drop text selection in buffer.
722 ///
723 /// Default: true
724 pub enabled: Option<bool>,
725
726 /// The delay in milliseconds that must elapse before drag and drop is allowed. Otherwise, a new text selection is created.
727 ///
728 /// Default: 300
729 pub delay: Option<DelayMs>,
730}
731
732/// When to show the minimap in the editor.
733///
734/// Default: never
735#[derive(
736 Copy,
737 Clone,
738 Debug,
739 Default,
740 Serialize,
741 Deserialize,
742 JsonSchema,
743 MergeFrom,
744 PartialEq,
745 Eq,
746 strum::VariantArray,
747 strum::VariantNames,
748)]
749#[serde(rename_all = "snake_case")]
750pub enum ShowMinimap {
751 /// Follow the visibility of the scrollbar.
752 Auto,
753 /// Always show the minimap.
754 Always,
755 /// Never show the minimap.
756 #[default]
757 Never,
758}
759
760/// Where to show the minimap in the editor.
761///
762/// Default: all_editors
763#[derive(
764 Copy,
765 Clone,
766 Debug,
767 Default,
768 Serialize,
769 Deserialize,
770 JsonSchema,
771 MergeFrom,
772 PartialEq,
773 Eq,
774 strum::VariantArray,
775 strum::VariantNames,
776)]
777#[serde(rename_all = "snake_case")]
778pub enum DisplayIn {
779 /// Show on all open editors.
780 AllEditors,
781 /// Show the minimap on the active editor only.
782 #[default]
783 ActiveEditor,
784}
785
786/// Minimum APCA perceptual contrast for text over highlight backgrounds.
787///
788/// Valid range: 0.0 to 106.0
789/// Default: 45.0
790#[derive(
791 Clone,
792 Copy,
793 Debug,
794 Serialize,
795 Deserialize,
796 JsonSchema,
797 MergeFrom,
798 PartialEq,
799 PartialOrd,
800 derive_more::FromStr,
801)]
802#[serde(transparent)]
803pub struct MinimumContrast(pub f32);
804
805impl Display for MinimumContrast {
806 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
807 write!(f, "{:.1}", self.0)
808 }
809}
810
811impl From<f32> for MinimumContrast {
812 fn from(x: f32) -> Self {
813 Self(x)
814 }
815}
816
817/// Opacity of the inactive panes. 0 means transparent, 1 means opaque.
818///
819/// Valid range: 0.0 to 1.0
820/// Default: 1.0
821#[derive(
822 Clone,
823 Copy,
824 Debug,
825 Serialize,
826 Deserialize,
827 JsonSchema,
828 MergeFrom,
829 PartialEq,
830 PartialOrd,
831 derive_more::FromStr,
832)]
833#[serde(transparent)]
834pub struct InactiveOpacity(pub f32);
835
836impl Display for InactiveOpacity {
837 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
838 write!(f, "{:.1}", self.0)
839 }
840}
841
842impl From<f32> for InactiveOpacity {
843 fn from(x: f32) -> Self {
844 Self(x)
845 }
846}