1use settings::{LanguageSettingsContent, SettingsContent};
2use std::sync::Arc;
3use ui::{IntoElement, SharedString};
4
5use crate::{
6 LOCAL, SettingField, SettingItem, SettingsFieldMetadata, SettingsPage, SettingsPageItem,
7 SubPageLink, USER, sub_page_stack,
8};
9
10pub(crate) fn settings_data() -> Vec<SettingsPage> {
11 vec![
12 SettingsPage {
13 title: "General",
14 items: vec![
15 SettingsPageItem::SectionHeader("General Settings"),
16 SettingsPageItem::SettingItem(SettingItem {
17 title: "Confirm Quit",
18 description: "Whether to confirm before quitting Zed",
19 field: Box::new(SettingField {
20 pick: |settings_content| &settings_content.workspace.confirm_quit,
21 pick_mut: |settings_content| &mut settings_content.workspace.confirm_quit,
22 }),
23 metadata: None,
24 files: USER,
25 }),
26 SettingsPageItem::SettingItem(SettingItem {
27 title: "Restore On Startup",
28 description: "Whether to restore previous session when opening Zed",
29 field: Box::new(SettingField {
30 pick: |settings_content| &settings_content.workspace.restore_on_startup,
31 pick_mut: |settings_content| {
32 &mut settings_content.workspace.restore_on_startup
33 },
34 }),
35 metadata: None,
36 files: USER,
37 }),
38 SettingsPageItem::SettingItem(SettingItem {
39 title: "Restore File State",
40 description: "Whether to restore previous file state when reopening",
41 field: Box::new(SettingField {
42 pick: |settings_content| &settings_content.workspace.restore_on_file_reopen,
43 pick_mut: |settings_content| {
44 &mut settings_content.workspace.restore_on_file_reopen
45 },
46 }),
47 metadata: None,
48 files: USER,
49 }),
50 SettingsPageItem::SettingItem(SettingItem {
51 title: "Close on File Delete",
52 description: "Whether to automatically close files that have been deleted",
53 field: Box::new(SettingField {
54 pick: |settings_content| &settings_content.workspace.close_on_file_delete,
55 pick_mut: |settings_content| {
56 &mut settings_content.workspace.close_on_file_delete
57 },
58 }),
59 metadata: None,
60 files: USER,
61 }),
62 SettingsPageItem::SettingItem(SettingItem {
63 title: "When Closing With No Tabs",
64 description: "What to do when using the 'close active item' action with no tabs",
65 field: Box::new(SettingField {
66 pick: |settings_content| {
67 &settings_content.workspace.when_closing_with_no_tabs
68 },
69 pick_mut: |settings_content| {
70 &mut settings_content.workspace.when_closing_with_no_tabs
71 },
72 }),
73 metadata: None,
74 files: USER,
75 }),
76 SettingsPageItem::SettingItem(SettingItem {
77 title: "On Last Window Closed",
78 description: "What to do when the last window is closed",
79 field: Box::new(SettingField {
80 pick: |settings_content| &settings_content.workspace.on_last_window_closed,
81 pick_mut: |settings_content| {
82 &mut settings_content.workspace.on_last_window_closed
83 },
84 }),
85 metadata: None,
86 files: USER,
87 }),
88 SettingsPageItem::SettingItem(SettingItem {
89 title: "Use System Path Prompts",
90 description: "Whether to use native OS dialogs for 'Open' and 'Save As'",
91 field: Box::new(SettingField {
92 pick: |settings_content| {
93 &settings_content.workspace.use_system_path_prompts
94 },
95 pick_mut: |settings_content| {
96 &mut settings_content.workspace.use_system_path_prompts
97 },
98 }),
99 metadata: None,
100 files: USER,
101 }),
102 SettingsPageItem::SettingItem(SettingItem {
103 title: "Use System Prompts",
104 description: "Whether to use native OS dialogs for confirmations",
105 field: Box::new(SettingField {
106 pick: |settings_content| &settings_content.workspace.use_system_prompts,
107 pick_mut: |settings_content| {
108 &mut settings_content.workspace.use_system_prompts
109 },
110 }),
111 metadata: None,
112 files: USER,
113 }),
114 // SettingsPageItem::SectionHeader("Scoped Settings"),
115 // todo(settings_ui): Implement another setting item type that just shows an edit in settings.json
116 // files: USER,
117 // SettingsPageItem::SettingItem(SettingItem {
118 // title: "Preview Channel",
119 // description: "Which settings should be activated only in Preview build of Zed",
120 // field: Box::new(SettingField {
121 // pick: |settings_content| &settings_content.workspace.use_system_prompts,
122 // pick_mut: |settings_content| {
123 // &mut settings_content.workspace.use_system_prompts
124 // },
125 // }),
126 // metadata: None,
127 // }),
128 // files: USER,
129 // SettingsPageItem::SettingItem(SettingItem {
130 // title: "Settings Profiles",
131 // description: "Any number of settings profiles that are temporarily applied on top of your existing user settings.",
132 // field: Box::new(SettingField {
133 // pick: |settings_content| &settings_content.workspace.use_system_prompts,
134 // pick_mut: |settings_content| {
135 // &mut settings_content.workspace.use_system_prompts
136 // },
137 // }),
138 // metadata: None,
139 // }),
140 SettingsPageItem::SectionHeader("Privacy"),
141 SettingsPageItem::SettingItem(SettingItem {
142 title: "Telemetry Diagnostics",
143 description: "Send debug information like crash reports",
144 field: Box::new(SettingField {
145 pick: |settings_content| {
146 if let Some(telemetry) = &settings_content.telemetry {
147 &telemetry.diagnostics
148 } else {
149 &None
150 }
151 },
152 pick_mut: |settings_content| {
153 &mut settings_content
154 .telemetry
155 .get_or_insert_default()
156 .diagnostics
157 },
158 }),
159 metadata: None,
160 files: USER,
161 }),
162 SettingsPageItem::SettingItem(SettingItem {
163 title: "Telemetry Metrics",
164 description: "Send anonymized usage data like what languages you're using Zed with",
165 field: Box::new(SettingField {
166 pick: |settings_content| {
167 if let Some(telemetry) = &settings_content.telemetry {
168 &telemetry.metrics
169 } else {
170 &None
171 }
172 },
173 pick_mut: |settings_content| {
174 &mut settings_content.telemetry.get_or_insert_default().metrics
175 },
176 }),
177 metadata: None,
178 files: USER,
179 }),
180 ],
181 },
182 SettingsPage {
183 title: "Appearance & Behavior",
184 items: vec![
185 // SettingsPageItem::SectionHeader("Theme"),
186 // todo(settings_ui): Figure out how we want to add these
187 // files: USER,
188 // SettingsPageItem::SettingItem(SettingItem {
189 // title: "Theme Mode",
190 // description: "How to select the theme",
191 // field: Box::new(SettingField {
192 // pick: |settings_content| &settings_content.theme.theme,
193 // pick_mut: |settings_content| &mut settings_content.theme.theme,
194 // }),
195 // metadata: None,
196 // }),
197 // files: USER,
198 // SettingsPageItem::SettingItem(SettingItem {
199 // title: "Icon Theme",
200 // // todo(settings_ui)
201 // // This description is misleading because the icon theme is used in more places than the file explorer)
202 // description: "Choose the icon theme for file explorer",
203 // field: Box::new(SettingField {
204 // pick: |settings_content| &settings_content.theme.icon_theme,
205 // pick_mut: |settings_content| &mut settings_content.theme.icon_theme,
206 // }),
207 // metadata: None,
208 // }),
209 SettingsPageItem::SectionHeader("Fonts"),
210 SettingsPageItem::SettingItem(SettingItem {
211 title: "Buffer Font Family",
212 description: "Font family for editor text",
213 field: Box::new(SettingField {
214 pick: |settings_content| &settings_content.theme.buffer_font_family,
215 pick_mut: |settings_content| &mut settings_content.theme.buffer_font_family,
216 }),
217 metadata: None,
218 files: USER,
219 }),
220 SettingsPageItem::SettingItem(SettingItem {
221 title: "Buffer Font Size",
222 description: "Font size for editor text",
223 field: Box::new(SettingField {
224 pick: |settings_content| &settings_content.theme.buffer_font_size,
225 pick_mut: |settings_content| &mut settings_content.theme.buffer_font_size,
226 }),
227 metadata: None,
228 files: USER,
229 }),
230 SettingsPageItem::SettingItem(SettingItem {
231 title: "Buffer Font Weight",
232 description: "Font weight for editor text (100-900)",
233 field: Box::new(SettingField {
234 pick: |settings_content| &settings_content.theme.buffer_font_weight,
235 pick_mut: |settings_content| &mut settings_content.theme.buffer_font_weight,
236 }),
237 metadata: None,
238 files: USER,
239 }),
240 // todo(settings_ui): This needs custom ui
241 // files: USER,
242 // SettingsPageItem::SettingItem(SettingItem {
243 // title: "Buffer Line Height",
244 // description: "Line height for editor text",
245 // field: Box::new(SettingField {
246 // pick: |settings_content| &settings_content.theme.buffer_line_height,
247 // pick_mut: |settings_content| &mut settings_content.theme.buffer_line_height,
248 // }),
249 // metadata: None,
250 // }),
251 SettingsPageItem::SettingItem(SettingItem {
252 title: "UI Font Family",
253 description: "Font family for UI elements",
254 field: Box::new(SettingField {
255 pick: |settings_content| &settings_content.theme.ui_font_family,
256 pick_mut: |settings_content| &mut settings_content.theme.ui_font_family,
257 }),
258 metadata: None,
259 files: USER,
260 }),
261 SettingsPageItem::SettingItem(SettingItem {
262 title: "UI Font Size",
263 description: "Font size for UI elements",
264 field: Box::new(SettingField {
265 pick: |settings_content| &settings_content.theme.ui_font_size,
266 pick_mut: |settings_content| &mut settings_content.theme.ui_font_size,
267 }),
268 metadata: None,
269 files: USER,
270 }),
271 SettingsPageItem::SettingItem(SettingItem {
272 title: "UI Font Weight",
273 description: "Font weight for UI elements (100-900)",
274 field: Box::new(SettingField {
275 pick: |settings_content| &settings_content.theme.ui_font_weight,
276 pick_mut: |settings_content| &mut settings_content.theme.ui_font_weight,
277 }),
278 metadata: None,
279 files: USER,
280 }),
281 SettingsPageItem::SectionHeader("Keymap"),
282 SettingsPageItem::SettingItem(SettingItem {
283 title: "Base Keymap",
284 description: "The name of a base set of key bindings to use",
285 field: Box::new(SettingField {
286 pick: |settings_content| &settings_content.base_keymap,
287 pick_mut: |settings_content| &mut settings_content.base_keymap,
288 }),
289 metadata: None,
290 files: USER,
291 }),
292 // todo(settings_ui): Vim/Helix Mode should be apart of one type because it's undefined
293 // behavior to have them both enabled at the same time
294 SettingsPageItem::SettingItem(SettingItem {
295 title: "Vim Mode",
296 description: "Whether to enable vim modes and key bindings",
297 field: Box::new(SettingField {
298 pick: |settings_content| &settings_content.vim_mode,
299 pick_mut: |settings_content| &mut settings_content.vim_mode,
300 }),
301 metadata: None,
302 files: USER,
303 }),
304 SettingsPageItem::SettingItem(SettingItem {
305 title: "Helix Mode",
306 description: "Whether to enable helix modes and key bindings",
307 field: Box::new(SettingField {
308 pick: |settings_content| &settings_content.helix_mode,
309 pick_mut: |settings_content| &mut settings_content.helix_mode,
310 }),
311 metadata: None,
312 files: USER,
313 }),
314 SettingsPageItem::SettingItem(SettingItem {
315 title: "Multi Cursor Modifier",
316 description: "Modifier key for adding multiple cursors",
317 field: Box::new(SettingField {
318 pick: |settings_content| &settings_content.editor.multi_cursor_modifier,
319 pick_mut: |settings_content| {
320 &mut settings_content.editor.multi_cursor_modifier
321 },
322 }),
323 metadata: None,
324 files: USER,
325 }),
326 SettingsPageItem::SectionHeader("Cursor"),
327 SettingsPageItem::SettingItem(SettingItem {
328 title: "Cursor Blink",
329 description: "Whether the cursor blinks in the editor",
330 field: Box::new(SettingField {
331 pick: |settings_content| &settings_content.editor.cursor_blink,
332 pick_mut: |settings_content| &mut settings_content.editor.cursor_blink,
333 }),
334 metadata: None,
335 files: USER,
336 }),
337 SettingsPageItem::SettingItem(SettingItem {
338 title: "Cursor Shape",
339 description: "Cursor shape for the editor",
340 field: Box::new(SettingField {
341 pick: |settings_content| &settings_content.editor.cursor_shape,
342 pick_mut: |settings_content| &mut settings_content.editor.cursor_shape,
343 }),
344 metadata: None,
345 files: USER,
346 }),
347 SettingsPageItem::SettingItem(SettingItem {
348 title: "Hide Mouse",
349 description: "When to hide the mouse cursor",
350 field: Box::new(SettingField {
351 pick: |settings_content| &settings_content.editor.hide_mouse,
352 pick_mut: |settings_content| &mut settings_content.editor.hide_mouse,
353 }),
354 metadata: None,
355 files: USER,
356 }),
357 SettingsPageItem::SectionHeader("Highlighting"),
358 SettingsPageItem::SettingItem(SettingItem {
359 title: "Unnecessary Code Fade",
360 description: "How much to fade out unused code (0.0 - 0.9)",
361 field: Box::new(SettingField {
362 pick: |settings_content| &settings_content.theme.unnecessary_code_fade,
363 pick_mut: |settings_content| {
364 &mut settings_content.theme.unnecessary_code_fade
365 },
366 }),
367 metadata: None,
368 files: USER,
369 }),
370 SettingsPageItem::SettingItem(SettingItem {
371 title: "Current Line Highlight",
372 description: "How to highlight the current line",
373 field: Box::new(SettingField {
374 pick: |settings_content| &settings_content.editor.current_line_highlight,
375 pick_mut: |settings_content| {
376 &mut settings_content.editor.current_line_highlight
377 },
378 }),
379 metadata: None,
380 files: USER,
381 }),
382 SettingsPageItem::SettingItem(SettingItem {
383 title: "Selection Highlight",
384 description: "Whether to highlight all occurrences of selected text",
385 field: Box::new(SettingField {
386 pick: |settings_content| &settings_content.editor.selection_highlight,
387 pick_mut: |settings_content| {
388 &mut settings_content.editor.selection_highlight
389 },
390 }),
391 metadata: None,
392 files: USER,
393 }),
394 SettingsPageItem::SettingItem(SettingItem {
395 title: "Rounded Selection",
396 description: "Whether the text selection should have rounded corners",
397 field: Box::new(SettingField {
398 pick: |settings_content| &settings_content.editor.rounded_selection,
399 pick_mut: |settings_content| &mut settings_content.editor.rounded_selection,
400 }),
401 metadata: None,
402 files: USER,
403 }),
404 SettingsPageItem::SectionHeader("Guides"),
405 SettingsPageItem::SettingItem(SettingItem {
406 title: "Show Wrap Guides",
407 description: "Whether to show wrap guides (vertical rulers)",
408 field: Box::new(SettingField {
409 pick: |settings_content| {
410 &settings_content
411 .project
412 .all_languages
413 .defaults
414 .show_wrap_guides
415 },
416 pick_mut: |settings_content| {
417 &mut settings_content
418 .project
419 .all_languages
420 .defaults
421 .show_wrap_guides
422 },
423 }),
424 metadata: None,
425 files: USER | LOCAL,
426 }),
427 // todo(settings_ui): This needs a custom component
428 SettingsPageItem::SettingItem(SettingItem {
429 title: "Wrap Guides",
430 description: "Character counts at which to show wrap guides",
431 field: Box::new(
432 SettingField {
433 pick: |settings_content| {
434 &settings_content.project.all_languages.defaults.wrap_guides
435 },
436 pick_mut: |settings_content| {
437 &mut settings_content.project.all_languages.defaults.wrap_guides
438 },
439 }
440 .unimplemented(),
441 ),
442 metadata: None,
443 files: USER | LOCAL,
444 }),
445 SettingsPageItem::SectionHeader("Whitespace"),
446 SettingsPageItem::SettingItem(SettingItem {
447 title: "Show Whitespace",
448 description: "Whether to show tabs and spaces",
449 field: Box::new(SettingField {
450 pick: |settings_content| {
451 &settings_content
452 .project
453 .all_languages
454 .defaults
455 .show_whitespaces
456 },
457 pick_mut: |settings_content| {
458 &mut settings_content
459 .project
460 .all_languages
461 .defaults
462 .show_whitespaces
463 },
464 }),
465 metadata: None,
466 files: USER | LOCAL,
467 }),
468 SettingsPageItem::SectionHeader("Layout"),
469 SettingsPageItem::SettingItem(SettingItem {
470 title: "Bottom Dock Layout",
471 description: "Layout mode for the bottom dock",
472 field: Box::new(SettingField {
473 pick: |settings_content| &settings_content.workspace.bottom_dock_layout,
474 pick_mut: |settings_content| {
475 &mut settings_content.workspace.bottom_dock_layout
476 },
477 }),
478 metadata: None,
479 files: USER,
480 }),
481 // files: USER,
482 // SettingsPageItem::SettingItem(SettingItem {
483 // title: "Centered Layout Left Padding",
484 // description: "Left padding for centered layout",
485 // field: Box::new(SettingField {
486 // pick: |settings_content| {
487 // if let Some(centered_layout) =
488 // &settings_content.workspace.centered_layout
489 // {
490 // ¢ered_layout.left_padding
491 // } else {
492 // &None
493 // }
494 // },
495 // pick_mut: |settings_content| {
496 // if let Some(mut centered_layout) =
497 // settings_content.workspace.centered_layout
498 // {
499 // &mut centered_layout.left_padding
500 // } else {
501 // &mut None
502 // }
503 // },
504 // }),
505 // metadata: None,
506 // }),
507 // files: USER,
508 // SettingsPageItem::SettingItem(SettingItem {
509 // title: "Centered Layout Right Padding",
510 // description: "Right padding for centered layout",
511 // field: Box::new(SettingField {
512 // pick: |settings_content| {
513 // if let Some(centered_layout) =
514 // &settings_content.workspace.centered_layout
515 // {
516 // ¢ered_layout.right_padding
517 // } else {
518 // &None
519 // }
520 // },
521 // pick_mut: |settings_content| {
522 // if let Some(mut centered_layout) =
523 // settings_content.workspace.centered_layout
524 // {
525 // &mut centered_layout.right_padding
526 // } else {
527 // &mut None
528 // }
529 // },
530 // }),
531 // metadata: None,
532 // }),
533 SettingsPageItem::SettingItem(SettingItem {
534 title: "Zoomed Padding",
535 description: "Whether to show padding for zoomed panels",
536 field: Box::new(SettingField {
537 pick: |settings_content| &settings_content.workspace.zoomed_padding,
538 pick_mut: |settings_content| &mut settings_content.workspace.zoomed_padding,
539 }),
540 metadata: None,
541 files: USER,
542 }),
543 SettingsPageItem::SettingItem(SettingItem {
544 title: "Use System Window Tabs",
545 description: "(macOS-only) Whether to allow windows to merge based on the user's tabbing preference",
546 field: Box::new(SettingField {
547 pick: |settings_content| &settings_content.workspace.use_system_window_tabs,
548 pick_mut: |settings_content| {
549 &mut settings_content.workspace.use_system_window_tabs
550 },
551 }),
552 metadata: None,
553 files: USER,
554 }),
555 SettingsPageItem::SectionHeader("Window"),
556 // todo(settings_ui): Should we filter by platform?
557 SettingsPageItem::SettingItem(SettingItem {
558 title: "Use System Window Tabs",
559 description: "(macOS only) Whether to allow windows to tab together",
560 field: Box::new(SettingField {
561 pick: |settings_content| &settings_content.workspace.use_system_window_tabs,
562 pick_mut: |settings_content| {
563 &mut settings_content.workspace.use_system_window_tabs
564 },
565 }),
566 metadata: None,
567 files: USER,
568 }),
569 ],
570 },
571 SettingsPage {
572 title: "Editor",
573 items: {
574 let mut items = vec![
575 SettingsPageItem::SectionHeader("Search"),
576 SettingsPageItem::SettingItem(SettingItem {
577 title: "Search Wrap",
578 description: "Whether the editor search results will loop",
579 field: Box::new(SettingField {
580 pick: |settings_content| &settings_content.editor.search_wrap,
581 pick_mut: |settings_content| &mut settings_content.editor.search_wrap,
582 }),
583 metadata: None,
584 files: USER,
585 }),
586 SettingsPageItem::SettingItem(SettingItem {
587 title: "Seed Search Query From Cursor",
588 description: "When to populate a new search's query based on the text under the cursor",
589 field: Box::new(SettingField {
590 pick: |settings_content| {
591 &settings_content.editor.seed_search_query_from_cursor
592 },
593 pick_mut: |settings_content| {
594 &mut settings_content.editor.seed_search_query_from_cursor
595 },
596 }),
597 metadata: None,
598 files: USER,
599 }),
600 SettingsPageItem::SettingItem(SettingItem {
601 title: "Use Smartcase Search",
602 description: "Whether to use smartcase (i.e., case-sensitive) search",
603 field: Box::new(SettingField {
604 pick: |settings_content| &settings_content.editor.use_smartcase_search,
605 pick_mut: |settings_content| {
606 &mut settings_content.editor.use_smartcase_search
607 },
608 }),
609 metadata: None,
610 files: USER,
611 }),
612 SettingsPageItem::SectionHeader("Editor Behavior"),
613 SettingsPageItem::SettingItem(SettingItem {
614 title: "Redact Private Values",
615 description: "Hide the values of variables in private files",
616 field: Box::new(SettingField {
617 pick: |settings_content| &settings_content.editor.redact_private_values,
618 pick_mut: |settings_content| {
619 &mut settings_content.editor.redact_private_values
620 },
621 }),
622 metadata: None,
623 files: USER,
624 }),
625 SettingsPageItem::SettingItem(SettingItem {
626 title: "Middle Click Paste",
627 description: "Whether to enable middle-click paste on Linux",
628 field: Box::new(SettingField {
629 pick: |settings_content| &settings_content.editor.middle_click_paste,
630 pick_mut: |settings_content| {
631 &mut settings_content.editor.middle_click_paste
632 },
633 }),
634 metadata: None,
635 files: USER,
636 }),
637 SettingsPageItem::SettingItem(SettingItem {
638 title: "Double Click In Multibuffer",
639 description: "What to do when multibuffer is double-clicked in some of its excerpts",
640 field: Box::new(SettingField {
641 pick: |settings_content| {
642 &settings_content.editor.double_click_in_multibuffer
643 },
644 pick_mut: |settings_content| {
645 &mut settings_content.editor.double_click_in_multibuffer
646 },
647 }),
648 metadata: None,
649 files: USER,
650 }),
651 SettingsPageItem::SettingItem(SettingItem {
652 title: "Go To Definition Fallback",
653 description: "Whether to follow-up empty go to definition responses from the language server",
654 field: Box::new(SettingField {
655 pick: |settings_content| {
656 &settings_content.editor.go_to_definition_fallback
657 },
658 pick_mut: |settings_content| {
659 &mut settings_content.editor.go_to_definition_fallback
660 },
661 }),
662 metadata: None,
663 files: USER,
664 }),
665 SettingsPageItem::SettingItem(SettingItem {
666 title: "Expand Excerpt Lines",
667 description: "How many lines to expand the multibuffer excerpts by default",
668 field: Box::new(SettingField {
669 pick: |settings_content| &settings_content.editor.expand_excerpt_lines,
670 pick_mut: |settings_content| {
671 &mut settings_content.editor.expand_excerpt_lines
672 },
673 }),
674 metadata: None,
675 files: USER,
676 }),
677 SettingsPageItem::SettingItem(SettingItem {
678 title: "Excerpt Context Lines",
679 description: "How many lines of context to provide in multibuffer excerpts by default",
680 field: Box::new(SettingField {
681 pick: |settings_content| &settings_content.editor.excerpt_context_lines,
682 pick_mut: |settings_content| {
683 &mut settings_content.editor.excerpt_context_lines
684 },
685 }),
686 metadata: None,
687 files: USER,
688 }),
689 SettingsPageItem::SettingItem(SettingItem {
690 title: "Minimum Contrast For Highlights",
691 description: "The minimum APCA perceptual contrast to maintain when rendering text over highlight backgrounds",
692 field: Box::new(SettingField {
693 pick: |settings_content| {
694 &settings_content.editor.minimum_contrast_for_highlights
695 },
696 pick_mut: |settings_content| {
697 &mut settings_content.editor.minimum_contrast_for_highlights
698 },
699 }),
700 metadata: None,
701 files: USER,
702 }),
703 SettingsPageItem::SectionHeader("Scrolling"),
704 SettingsPageItem::SettingItem(SettingItem {
705 title: "Scroll Beyond Last Line",
706 description: "Whether the editor will scroll beyond the last line",
707 field: Box::new(SettingField {
708 pick: |settings_content| {
709 &settings_content.editor.scroll_beyond_last_line
710 },
711 pick_mut: |settings_content| {
712 &mut settings_content.editor.scroll_beyond_last_line
713 },
714 }),
715 metadata: None,
716 files: USER,
717 }),
718 SettingsPageItem::SettingItem(SettingItem {
719 title: "Vertical Scroll Margin",
720 description: "The number of lines to keep above/below the cursor when auto-scrolling",
721 field: Box::new(SettingField {
722 pick: |settings_content| {
723 &settings_content.editor.vertical_scroll_margin
724 },
725 pick_mut: |settings_content| {
726 &mut settings_content.editor.vertical_scroll_margin
727 },
728 }),
729 metadata: None,
730 files: USER,
731 }),
732 SettingsPageItem::SettingItem(SettingItem {
733 title: "Horizontal Scroll Margin",
734 description: "The number of characters to keep on either side when scrolling with the mouse",
735 field: Box::new(SettingField {
736 pick: |settings_content| {
737 &settings_content.editor.horizontal_scroll_margin
738 },
739 pick_mut: |settings_content| {
740 &mut settings_content.editor.horizontal_scroll_margin
741 },
742 }),
743 metadata: None,
744 files: USER,
745 }),
746 SettingsPageItem::SettingItem(SettingItem {
747 title: "Scroll Sensitivity",
748 description: "Scroll sensitivity multiplier for both horizontal and vertical scrolling",
749 field: Box::new(SettingField {
750 pick: |settings_content| &settings_content.editor.scroll_sensitivity,
751 pick_mut: |settings_content| {
752 &mut settings_content.editor.scroll_sensitivity
753 },
754 }),
755 metadata: None,
756 files: USER,
757 }),
758 SettingsPageItem::SettingItem(SettingItem {
759 title: "Fast Scroll Sensitivity",
760 description: "Fast Scroll sensitivity multiplier for both horizontal and vertical scrolling",
761 field: Box::new(SettingField {
762 pick: |settings_content| {
763 &settings_content.editor.fast_scroll_sensitivity
764 },
765 pick_mut: |settings_content| {
766 &mut settings_content.editor.fast_scroll_sensitivity
767 },
768 }),
769 metadata: None,
770 files: USER,
771 }),
772 SettingsPageItem::SettingItem(SettingItem {
773 title: "Autoscroll On Clicks",
774 description: "Whether to scroll when clicking near the edge of the visible text area",
775 field: Box::new(SettingField {
776 pick: |settings_content| &settings_content.editor.autoscroll_on_clicks,
777 pick_mut: |settings_content| {
778 &mut settings_content.editor.autoscroll_on_clicks
779 },
780 }),
781 metadata: None,
782 files: USER,
783 }),
784 SettingsPageItem::SectionHeader("Signature Help"),
785 SettingsPageItem::SettingItem(SettingItem {
786 title: "Auto Signature Help",
787 description: "Whether to automatically show a signature help pop-up or not",
788 field: Box::new(SettingField {
789 pick: |settings_content| &settings_content.editor.auto_signature_help,
790 pick_mut: |settings_content| {
791 &mut settings_content.editor.auto_signature_help
792 },
793 }),
794 metadata: None,
795 files: USER,
796 }),
797 SettingsPageItem::SettingItem(SettingItem {
798 title: "Show Signature Help After Edits",
799 description: "Whether to show the signature help pop-up after completions or bracket pairs inserted",
800 field: Box::new(SettingField {
801 pick: |settings_content| {
802 &settings_content.editor.show_signature_help_after_edits
803 },
804 pick_mut: |settings_content| {
805 &mut settings_content.editor.show_signature_help_after_edits
806 },
807 }),
808 metadata: None,
809 files: USER,
810 }),
811 SettingsPageItem::SettingItem(SettingItem {
812 title: "Snippet Sort Order",
813 description: "Determines how snippets are sorted relative to other completion items",
814 field: Box::new(SettingField {
815 pick: |settings_content| &settings_content.editor.snippet_sort_order,
816 pick_mut: |settings_content| {
817 &mut settings_content.editor.snippet_sort_order
818 },
819 }),
820 metadata: None,
821 files: USER,
822 }),
823 SettingsPageItem::SectionHeader("Hover"),
824 SettingsPageItem::SettingItem(SettingItem {
825 title: "Hover Popover Enabled",
826 description: "Whether to show the informational hover box when moving the mouse over symbols in the editor",
827 field: Box::new(SettingField {
828 pick: |settings_content| &settings_content.editor.hover_popover_enabled,
829 pick_mut: |settings_content| {
830 &mut settings_content.editor.hover_popover_enabled
831 },
832 }),
833 metadata: None,
834 files: USER,
835 }),
836 // todo(settings ui): add units to this number input
837 SettingsPageItem::SettingItem(SettingItem {
838 title: "Hover Popover Delay",
839 description: "Time to wait in milliseconds before showing the informational hover box",
840 field: Box::new(SettingField {
841 pick: |settings_content| &settings_content.editor.hover_popover_delay,
842 pick_mut: |settings_content| {
843 &mut settings_content.editor.hover_popover_delay
844 },
845 }),
846 metadata: None,
847 files: USER,
848 }),
849 SettingsPageItem::SectionHeader("Code Actions"),
850 SettingsPageItem::SettingItem(SettingItem {
851 title: "Inline Code Actions",
852 description: "Whether to show code action button at start of buffer line",
853 field: Box::new(SettingField {
854 pick: |settings_content| &settings_content.editor.inline_code_actions,
855 pick_mut: |settings_content| {
856 &mut settings_content.editor.inline_code_actions
857 },
858 }),
859 metadata: None,
860 files: USER,
861 }),
862 SettingsPageItem::SectionHeader("Selection"),
863 SettingsPageItem::SettingItem(SettingItem {
864 title: "Drag And Drop Selection",
865 description: "Whether to enable drag and drop selection",
866 field: Box::new(SettingField {
867 pick: |settings_content| {
868 if let Some(drag_and_drop) =
869 &settings_content.editor.drag_and_drop_selection
870 {
871 &drag_and_drop.enabled
872 } else {
873 &None
874 }
875 },
876 pick_mut: |settings_content| {
877 &mut settings_content
878 .editor
879 .drag_and_drop_selection
880 .get_or_insert_default()
881 .enabled
882 },
883 }),
884 metadata: None,
885 files: USER,
886 }),
887 SettingsPageItem::SettingItem(SettingItem {
888 title: "Drag And Drop Selection Delay",
889 description: "Delay in milliseconds before drag and drop selection starts",
890 field: Box::new(SettingField {
891 pick: |settings_content| {
892 if let Some(drag_and_drop) =
893 &settings_content.editor.drag_and_drop_selection
894 {
895 &drag_and_drop.delay
896 } else {
897 &None
898 }
899 },
900 pick_mut: |settings_content| {
901 &mut settings_content
902 .editor
903 .drag_and_drop_selection
904 .get_or_insert_default()
905 .delay
906 },
907 }),
908 metadata: None,
909 files: USER,
910 }),
911 SettingsPageItem::SectionHeader("Gutter"),
912 SettingsPageItem::SettingItem(SettingItem {
913 title: "Show Line Numbers",
914 description: "Whether to show line numbers in the gutter",
915 field: Box::new(SettingField {
916 pick: |settings_content| {
917 if let Some(gutter) = &settings_content.editor.gutter {
918 &gutter.line_numbers
919 } else {
920 &None
921 }
922 },
923 pick_mut: |settings_content| {
924 &mut settings_content
925 .editor
926 .gutter
927 .get_or_insert_default()
928 .line_numbers
929 },
930 }),
931 metadata: None,
932 files: USER,
933 }),
934 SettingsPageItem::SettingItem(SettingItem {
935 title: "Relative Line Numbers",
936 description: "Whether the line numbers on editors gutter are relative or not",
937 field: Box::new(SettingField {
938 pick: |settings_content| &settings_content.editor.relative_line_numbers,
939 pick_mut: |settings_content| {
940 &mut settings_content.editor.relative_line_numbers
941 },
942 }),
943 metadata: None,
944 files: USER,
945 }),
946 SettingsPageItem::SettingItem(SettingItem {
947 title: "Show Runnables",
948 description: "Whether to show runnable buttons in the gutter",
949 field: Box::new(SettingField {
950 pick: |settings_content| {
951 if let Some(gutter) = &settings_content.editor.gutter {
952 &gutter.runnables
953 } else {
954 &None
955 }
956 },
957 pick_mut: |settings_content| {
958 &mut settings_content
959 .editor
960 .gutter
961 .get_or_insert_default()
962 .runnables
963 },
964 }),
965 metadata: None,
966 files: USER,
967 }),
968 SettingsPageItem::SettingItem(SettingItem {
969 title: "Show Breakpoints",
970 description: "Whether to show breakpoints in the gutter",
971 field: Box::new(SettingField {
972 pick: |settings_content| {
973 if let Some(gutter) = &settings_content.editor.gutter {
974 &gutter.breakpoints
975 } else {
976 &None
977 }
978 },
979 pick_mut: |settings_content| {
980 &mut settings_content
981 .editor
982 .gutter
983 .get_or_insert_default()
984 .breakpoints
985 },
986 }),
987 metadata: None,
988 files: USER,
989 }),
990 SettingsPageItem::SettingItem(SettingItem {
991 title: "Show Folds",
992 description: "Whether to show code folding controls in the gutter",
993 field: Box::new(SettingField {
994 pick: |settings_content| {
995 if let Some(gutter) = &settings_content.editor.gutter {
996 &gutter.folds
997 } else {
998 &None
999 }
1000 },
1001 pick_mut: |settings_content| {
1002 &mut settings_content.editor.gutter.get_or_insert_default().folds
1003 },
1004 }),
1005 metadata: None,
1006 files: USER,
1007 }),
1008 SettingsPageItem::SettingItem(SettingItem {
1009 title: "Min Line Number Digits",
1010 description: "Minimum number of characters to reserve space for in the gutter.",
1011 field: Box::new(SettingField {
1012 pick: |settings_content| {
1013 if let Some(gutter) = &settings_content.editor.gutter {
1014 &gutter.min_line_number_digits
1015 } else {
1016 &None
1017 }
1018 },
1019 pick_mut: |settings_content| {
1020 &mut settings_content
1021 .editor
1022 .gutter
1023 .get_or_insert_default()
1024 .min_line_number_digits
1025 },
1026 }),
1027 metadata: None,
1028 files: USER,
1029 }),
1030 SettingsPageItem::SectionHeader("Scrollbar"),
1031 SettingsPageItem::SettingItem(SettingItem {
1032 title: "Show",
1033 description: "When to show the scrollbar in the editor",
1034 field: Box::new(SettingField {
1035 pick: |settings_content| {
1036 if let Some(scrollbar) = &settings_content.editor.scrollbar {
1037 &scrollbar.show
1038 } else {
1039 &None
1040 }
1041 },
1042 pick_mut: |settings_content| {
1043 &mut settings_content
1044 .editor
1045 .scrollbar
1046 .get_or_insert_default()
1047 .show
1048 },
1049 }),
1050 metadata: None,
1051 files: USER,
1052 }),
1053 SettingsPageItem::SettingItem(SettingItem {
1054 title: "Cursors",
1055 description: "Whether to show cursor positions in the scrollbar",
1056 field: Box::new(SettingField {
1057 pick: |settings_content| {
1058 if let Some(scrollbar) = &settings_content.editor.scrollbar {
1059 &scrollbar.cursors
1060 } else {
1061 &None
1062 }
1063 },
1064 pick_mut: |settings_content| {
1065 &mut settings_content
1066 .editor
1067 .scrollbar
1068 .get_or_insert_default()
1069 .cursors
1070 },
1071 }),
1072 metadata: None,
1073 files: USER,
1074 }),
1075 SettingsPageItem::SettingItem(SettingItem {
1076 title: "Git Diff",
1077 description: "Whether to show git diff indicators in the scrollbar",
1078 field: Box::new(SettingField {
1079 pick: |settings_content| {
1080 if let Some(scrollbar) = &settings_content.editor.scrollbar {
1081 &scrollbar.git_diff
1082 } else {
1083 &None
1084 }
1085 },
1086 pick_mut: |settings_content| {
1087 &mut settings_content
1088 .editor
1089 .scrollbar
1090 .get_or_insert_default()
1091 .git_diff
1092 },
1093 }),
1094 metadata: None,
1095 files: USER,
1096 }),
1097 SettingsPageItem::SettingItem(SettingItem {
1098 title: "Search Results",
1099 description: "Whether to show buffer search result indicators in the scrollbar",
1100 field: Box::new(SettingField {
1101 pick: |settings_content| {
1102 if let Some(scrollbar) = &settings_content.editor.scrollbar {
1103 &scrollbar.search_results
1104 } else {
1105 &None
1106 }
1107 },
1108 pick_mut: |settings_content| {
1109 &mut settings_content
1110 .editor
1111 .scrollbar
1112 .get_or_insert_default()
1113 .search_results
1114 },
1115 }),
1116 metadata: None,
1117 files: USER,
1118 }),
1119 SettingsPageItem::SettingItem(SettingItem {
1120 title: "Selected Text",
1121 description: "Whether to show selected text occurrences in the scrollbar",
1122 field: Box::new(SettingField {
1123 pick: |settings_content| {
1124 if let Some(scrollbar) = &settings_content.editor.scrollbar {
1125 &scrollbar.selected_text
1126 } else {
1127 &None
1128 }
1129 },
1130 pick_mut: |settings_content| {
1131 &mut settings_content
1132 .editor
1133 .scrollbar
1134 .get_or_insert_default()
1135 .selected_text
1136 },
1137 }),
1138 metadata: None,
1139 files: USER,
1140 }),
1141 SettingsPageItem::SettingItem(SettingItem {
1142 title: "Selected Symbol",
1143 description: "Whether to show selected symbol occurrences in the scrollbar",
1144 field: Box::new(SettingField {
1145 pick: |settings_content| {
1146 if let Some(scrollbar) = &settings_content.editor.scrollbar {
1147 &scrollbar.selected_symbol
1148 } else {
1149 &None
1150 }
1151 },
1152 pick_mut: |settings_content| {
1153 &mut settings_content
1154 .editor
1155 .scrollbar
1156 .get_or_insert_default()
1157 .selected_symbol
1158 },
1159 }),
1160 metadata: None,
1161 files: USER,
1162 }),
1163 SettingsPageItem::SettingItem(SettingItem {
1164 title: "Diagnostics",
1165 description: "Which diagnostic indicators to show in the scrollbar",
1166 field: Box::new(SettingField {
1167 pick: |settings_content| {
1168 if let Some(scrollbar) = &settings_content.editor.scrollbar {
1169 &scrollbar.diagnostics
1170 } else {
1171 &None
1172 }
1173 },
1174 pick_mut: |settings_content| {
1175 &mut settings_content
1176 .editor
1177 .scrollbar
1178 .get_or_insert_default()
1179 .diagnostics
1180 },
1181 }),
1182 metadata: None,
1183 files: USER,
1184 }),
1185 SettingsPageItem::SettingItem(SettingItem {
1186 title: "Horizontal Scrollbar",
1187 description: "When false, forcefully disables the horizontal scrollbar",
1188 field: Box::new(SettingField {
1189 pick: |settings_content| {
1190 if let Some(scrollbar) = &settings_content.editor.scrollbar {
1191 if let Some(axes) = &scrollbar.axes {
1192 &axes.horizontal
1193 } else {
1194 &None
1195 }
1196 } else {
1197 &None
1198 }
1199 },
1200 pick_mut: |settings_content| {
1201 &mut settings_content
1202 .editor
1203 .scrollbar
1204 .get_or_insert_default()
1205 .axes
1206 .get_or_insert_default()
1207 .horizontal
1208 },
1209 }),
1210 metadata: None,
1211 files: USER,
1212 }),
1213 SettingsPageItem::SettingItem(SettingItem {
1214 title: "Vertical Scrollbar",
1215 description: "When false, forcefully disables the vertical scrollbar",
1216 field: Box::new(SettingField {
1217 pick: |settings_content| {
1218 if let Some(scrollbar) = &settings_content.editor.scrollbar {
1219 if let Some(axes) = &scrollbar.axes {
1220 &axes.vertical
1221 } else {
1222 &None
1223 }
1224 } else {
1225 &None
1226 }
1227 },
1228 pick_mut: |settings_content| {
1229 &mut settings_content
1230 .editor
1231 .scrollbar
1232 .get_or_insert_default()
1233 .axes
1234 .get_or_insert_default()
1235 .vertical
1236 },
1237 }),
1238 metadata: None,
1239 files: USER,
1240 }),
1241 SettingsPageItem::SectionHeader("Minimap"),
1242 SettingsPageItem::SettingItem(SettingItem {
1243 title: "Show",
1244 description: "When to show the minimap in the editor",
1245 field: Box::new(SettingField {
1246 pick: |settings_content| {
1247 if let Some(minimap) = &settings_content.editor.minimap {
1248 &minimap.show
1249 } else {
1250 &None
1251 }
1252 },
1253 pick_mut: |settings_content| {
1254 &mut settings_content.editor.minimap.get_or_insert_default().show
1255 },
1256 }),
1257 metadata: None,
1258 files: USER,
1259 }),
1260 SettingsPageItem::SettingItem(SettingItem {
1261 title: "Display In",
1262 description: "Where to show the minimap in the editor",
1263 field: Box::new(SettingField {
1264 pick: |settings_content| {
1265 if let Some(minimap) = &settings_content.editor.minimap {
1266 &minimap.display_in
1267 } else {
1268 &None
1269 }
1270 },
1271 pick_mut: |settings_content| {
1272 &mut settings_content
1273 .editor
1274 .minimap
1275 .get_or_insert_default()
1276 .display_in
1277 },
1278 }),
1279 metadata: None,
1280 files: USER,
1281 }),
1282 SettingsPageItem::SettingItem(SettingItem {
1283 title: "Thumb",
1284 description: "When to show the minimap thumb",
1285 field: Box::new(SettingField {
1286 pick: |settings_content| {
1287 if let Some(minimap) = &settings_content.editor.minimap {
1288 &minimap.thumb
1289 } else {
1290 &None
1291 }
1292 },
1293 pick_mut: |settings_content| {
1294 &mut settings_content
1295 .editor
1296 .minimap
1297 .get_or_insert_default()
1298 .thumb
1299 },
1300 }),
1301 metadata: None,
1302 files: USER,
1303 }),
1304 SettingsPageItem::SettingItem(SettingItem {
1305 title: "Thumb Border",
1306 description: "Border style for the minimap's scrollbar thumb",
1307 field: Box::new(SettingField {
1308 pick: |settings_content| {
1309 if let Some(minimap) = &settings_content.editor.minimap {
1310 &minimap.thumb_border
1311 } else {
1312 &None
1313 }
1314 },
1315 pick_mut: |settings_content| {
1316 &mut settings_content
1317 .editor
1318 .minimap
1319 .get_or_insert_default()
1320 .thumb_border
1321 },
1322 }),
1323 metadata: None,
1324 files: USER,
1325 }),
1326 SettingsPageItem::SettingItem(SettingItem {
1327 title: "Current Line Highlight",
1328 description: "How to highlight the current line in the minimap",
1329 field: Box::new(SettingField {
1330 pick: |settings_content| {
1331 if let Some(minimap) = &settings_content.editor.minimap
1332 && minimap.current_line_highlight.is_some()
1333 {
1334 &minimap.current_line_highlight
1335 } else {
1336 &settings_content.editor.current_line_highlight
1337 }
1338 },
1339 pick_mut: |settings_content| {
1340 &mut settings_content
1341 .editor
1342 .minimap
1343 .get_or_insert_default()
1344 .current_line_highlight
1345 },
1346 }),
1347 metadata: None,
1348 files: USER,
1349 }),
1350 SettingsPageItem::SettingItem(SettingItem {
1351 title: "Max Width Columns",
1352 description: "Maximum number of columns to display in the minimap",
1353 field: Box::new(SettingField {
1354 pick: |settings_content| {
1355 if let Some(minimap) = &settings_content.editor.minimap {
1356 &minimap.max_width_columns
1357 } else {
1358 &None
1359 }
1360 },
1361 pick_mut: |settings_content| {
1362 &mut settings_content
1363 .editor
1364 .minimap
1365 .get_or_insert_default()
1366 .max_width_columns
1367 },
1368 }),
1369 metadata: None,
1370 files: USER,
1371 }),
1372 SettingsPageItem::SectionHeader("Tabs"),
1373 SettingsPageItem::SettingItem(SettingItem {
1374 title: "Show Tab Bar",
1375 description: "Whether or not to show the tab bar in the editor",
1376 field: Box::new(SettingField {
1377 pick: |settings_content| {
1378 if let Some(tab_bar) = &settings_content.tab_bar {
1379 &tab_bar.show
1380 } else {
1381 &None
1382 }
1383 },
1384 pick_mut: |settings_content| {
1385 &mut settings_content.tab_bar.get_or_insert_default().show
1386 },
1387 }),
1388 metadata: None,
1389 files: USER,
1390 }),
1391 SettingsPageItem::SettingItem(SettingItem {
1392 title: "Show Git Status In Tabs",
1393 description: "Whether to show the Git file status on a tab item",
1394 field: Box::new(SettingField {
1395 pick: |settings_content| {
1396 if let Some(tabs) = &settings_content.tabs {
1397 &tabs.git_status
1398 } else {
1399 &None
1400 }
1401 },
1402 pick_mut: |settings_content| {
1403 &mut settings_content.tabs.get_or_insert_default().git_status
1404 },
1405 }),
1406 metadata: None,
1407 files: USER,
1408 }),
1409 SettingsPageItem::SettingItem(SettingItem {
1410 title: "Show File Icons In Tabs",
1411 description: "Whether to show the file icon for a tab",
1412 field: Box::new(SettingField {
1413 pick: |settings_content| {
1414 if let Some(tabs) = &settings_content.tabs {
1415 &tabs.file_icons
1416 } else {
1417 &None
1418 }
1419 },
1420 pick_mut: |settings_content| {
1421 &mut settings_content.tabs.get_or_insert_default().file_icons
1422 },
1423 }),
1424 metadata: None,
1425 files: USER,
1426 }),
1427 SettingsPageItem::SettingItem(SettingItem {
1428 title: "Tab Close Position",
1429 description: "Position of the close button in a tab",
1430 field: Box::new(SettingField {
1431 pick: |settings_content| {
1432 if let Some(tabs) = &settings_content.tabs {
1433 &tabs.close_position
1434 } else {
1435 &None
1436 }
1437 },
1438 pick_mut: |settings_content| {
1439 &mut settings_content.tabs.get_or_insert_default().close_position
1440 },
1441 }),
1442 metadata: None,
1443 files: USER,
1444 }),
1445 // files: USER,
1446 // SettingsPageItem::SettingItem(SettingItem {
1447 // title: "Maximum Tabs",
1448 // description: "Maximum open tabs in a pane. Will not close an unsaved tab",
1449 // // todo(settings_ui): The default for this value is null and it's use in code
1450 // // is complex, so I'm going to come back to this later
1451 // field: Box::new(SettingField {
1452 // pick: |settings_content| &settings_content.workspace.max_tabs,
1453 // pick_mut: |settings_content| &mut settings_content.workspace.max_tabs,
1454 // }),
1455 // metadata: None,
1456 // }),
1457 SettingsPageItem::SectionHeader("Toolbar"),
1458 SettingsPageItem::SettingItem(SettingItem {
1459 title: "Breadcrumbs",
1460 description: "Whether to show breadcrumbs",
1461 field: Box::new(SettingField {
1462 pick: |settings_content| {
1463 if let Some(toolbar) = &settings_content.editor.toolbar {
1464 &toolbar.breadcrumbs
1465 } else {
1466 &None
1467 }
1468 },
1469 pick_mut: |settings_content| {
1470 &mut settings_content
1471 .editor
1472 .toolbar
1473 .get_or_insert_default()
1474 .breadcrumbs
1475 },
1476 }),
1477 metadata: None,
1478 files: USER,
1479 }),
1480 SettingsPageItem::SettingItem(SettingItem {
1481 title: "Quick Actions",
1482 description: "Whether to show quick action buttons (e.g., search, selection, editor controls, etc.)",
1483 field: Box::new(SettingField {
1484 pick: |settings_content| {
1485 if let Some(toolbar) = &settings_content.editor.toolbar {
1486 &toolbar.quick_actions
1487 } else {
1488 &None
1489 }
1490 },
1491 pick_mut: |settings_content| {
1492 &mut settings_content
1493 .editor
1494 .toolbar
1495 .get_or_insert_default()
1496 .quick_actions
1497 },
1498 }),
1499 metadata: None,
1500 files: USER,
1501 }),
1502 SettingsPageItem::SettingItem(SettingItem {
1503 title: "Selections Menu",
1504 description: "Whether to show the selections menu in the editor toolbar",
1505 field: Box::new(SettingField {
1506 pick: |settings_content| {
1507 if let Some(toolbar) = &settings_content.editor.toolbar {
1508 &toolbar.selections_menu
1509 } else {
1510 &None
1511 }
1512 },
1513 pick_mut: |settings_content| {
1514 &mut settings_content
1515 .editor
1516 .toolbar
1517 .get_or_insert_default()
1518 .selections_menu
1519 },
1520 }),
1521 metadata: None,
1522 files: USER,
1523 }),
1524 SettingsPageItem::SettingItem(SettingItem {
1525 title: "Agent Review",
1526 description: "Whether to show agent review buttons in the editor toolbar",
1527 field: Box::new(SettingField {
1528 pick: |settings_content| {
1529 if let Some(toolbar) = &settings_content.editor.toolbar {
1530 &toolbar.agent_review
1531 } else {
1532 &None
1533 }
1534 },
1535 pick_mut: |settings_content| {
1536 &mut settings_content
1537 .editor
1538 .toolbar
1539 .get_or_insert_default()
1540 .agent_review
1541 },
1542 }),
1543 metadata: None,
1544 files: USER,
1545 }),
1546 SettingsPageItem::SettingItem(SettingItem {
1547 title: "Code Actions",
1548 description: "Whether to show code action buttons in the editor toolbar",
1549 field: Box::new(SettingField {
1550 pick: |settings_content| {
1551 if let Some(toolbar) = &settings_content.editor.toolbar {
1552 &toolbar.code_actions
1553 } else {
1554 &None
1555 }
1556 },
1557 pick_mut: |settings_content| {
1558 &mut settings_content
1559 .editor
1560 .toolbar
1561 .get_or_insert_default()
1562 .code_actions
1563 },
1564 }),
1565 metadata: None,
1566 files: USER,
1567 }),
1568 ];
1569 items.extend(language_settings_data());
1570 items
1571 },
1572 },
1573 SettingsPage {
1574 title: "Languages",
1575 items: vec![
1576 SettingsPageItem::SectionHeader(LANGUAGES_SECTION_HEADER),
1577 SettingsPageItem::SubPageLink(SubPageLink {
1578 title: "JSON",
1579 files: USER | LOCAL,
1580 render: Arc::new(|this, window, cx| {
1581 this.render_page_items(language_settings_data().iter(), window, cx)
1582 .into_any_element()
1583 }),
1584 }),
1585 SettingsPageItem::SubPageLink(SubPageLink {
1586 title: "JSONC",
1587 files: USER | LOCAL,
1588 render: Arc::new(|this, window, cx| {
1589 this.render_page_items(language_settings_data().iter(), window, cx)
1590 .into_any_element()
1591 }),
1592 }),
1593 SettingsPageItem::SubPageLink(SubPageLink {
1594 title: "Rust",
1595 files: USER | LOCAL,
1596 render: Arc::new(|this, window, cx| {
1597 this.render_page_items(language_settings_data().iter(), window, cx)
1598 .into_any_element()
1599 }),
1600 }),
1601 SettingsPageItem::SubPageLink(SubPageLink {
1602 title: "Python",
1603 files: USER | LOCAL,
1604 render: Arc::new(|this, window, cx| {
1605 this.render_page_items(language_settings_data().iter(), window, cx)
1606 .into_any_element()
1607 }),
1608 }),
1609 SettingsPageItem::SubPageLink(SubPageLink {
1610 title: "TSX",
1611 files: USER | LOCAL,
1612 render: Arc::new(|this, window, cx| {
1613 this.render_page_items(language_settings_data().iter(), window, cx)
1614 .into_any_element()
1615 }),
1616 }),
1617 ],
1618 },
1619 SettingsPage {
1620 title: "Workbench & Window",
1621 items: vec![
1622 SettingsPageItem::SectionHeader("Status Bar"),
1623 SettingsPageItem::SettingItem(SettingItem {
1624 title: "Active Language Button",
1625 description: "Whether to show the active language button in the status bar",
1626 field: Box::new(SettingField {
1627 pick: |settings_content| {
1628 if let Some(status_bar) = &settings_content.status_bar {
1629 &status_bar.active_language_button
1630 } else {
1631 &None
1632 }
1633 },
1634 pick_mut: |settings_content| {
1635 &mut settings_content
1636 .status_bar
1637 .get_or_insert_default()
1638 .active_language_button
1639 },
1640 }),
1641 metadata: None,
1642 files: USER,
1643 }),
1644 SettingsPageItem::SettingItem(SettingItem {
1645 title: "Cursor Position Button",
1646 description: "Whether to show the cursor position button in the status bar",
1647 field: Box::new(SettingField {
1648 pick: |settings_content| {
1649 if let Some(status_bar) = &settings_content.status_bar {
1650 &status_bar.cursor_position_button
1651 } else {
1652 &None
1653 }
1654 },
1655 pick_mut: |settings_content| {
1656 &mut settings_content
1657 .status_bar
1658 .get_or_insert_default()
1659 .cursor_position_button
1660 },
1661 }),
1662 metadata: None,
1663 files: USER,
1664 }),
1665 SettingsPageItem::SettingItem(SettingItem {
1666 title: "Terminal Button",
1667 description: "Whether to show the terminal button in the status bar",
1668 field: Box::new(SettingField {
1669 pick: |settings_content| {
1670 if let Some(terminal) = &settings_content.terminal {
1671 &terminal.button
1672 } else {
1673 &None
1674 }
1675 },
1676 pick_mut: |settings_content| {
1677 &mut settings_content.terminal.get_or_insert_default().button
1678 },
1679 }),
1680 metadata: None,
1681 files: USER,
1682 }),
1683 SettingsPageItem::SettingItem(SettingItem {
1684 title: "Diagnostics Button",
1685 description: "Whether to show the project diagnostics button in the status bar",
1686 field: Box::new(SettingField {
1687 pick: |settings_content| {
1688 if let Some(diagnostics) = &settings_content.diagnostics {
1689 &diagnostics.button
1690 } else {
1691 &None
1692 }
1693 },
1694 pick_mut: |settings_content| {
1695 &mut settings_content.diagnostics.get_or_insert_default().button
1696 },
1697 }),
1698 metadata: None,
1699 files: USER,
1700 }),
1701 SettingsPageItem::SettingItem(SettingItem {
1702 title: "Project Search Button",
1703 description: "Whether to show the project search button in the status bar",
1704 field: Box::new(SettingField {
1705 pick: |settings_content| {
1706 if let Some(search) = &settings_content.editor.search {
1707 &search.button
1708 } else {
1709 &None
1710 }
1711 },
1712 pick_mut: |settings_content| {
1713 &mut settings_content
1714 .editor
1715 .search
1716 .get_or_insert_default()
1717 .button
1718 },
1719 }),
1720 metadata: None,
1721 files: USER,
1722 }),
1723 SettingsPageItem::SectionHeader("Tab Bar"),
1724 SettingsPageItem::SettingItem(SettingItem {
1725 title: "Editor Tabs",
1726 description: "Whether or not to show the tab bar in the editor",
1727 field: Box::new(SettingField {
1728 pick: |settings_content| {
1729 if let Some(tab_bar) = &settings_content.tab_bar {
1730 &tab_bar.show
1731 } else {
1732 &None
1733 }
1734 },
1735 pick_mut: |settings_content| {
1736 &mut settings_content.tab_bar.get_or_insert_default().show
1737 },
1738 }),
1739 metadata: None,
1740 files: USER,
1741 }),
1742 SettingsPageItem::SettingItem(SettingItem {
1743 title: "Show Navigation History Buttons",
1744 description: "Whether or not to show the navigation history buttons in the tab bar",
1745 field: Box::new(SettingField {
1746 pick: |settings_content| {
1747 if let Some(tab_bar) = &settings_content.tab_bar {
1748 &tab_bar.show_nav_history_buttons
1749 } else {
1750 &None
1751 }
1752 },
1753 pick_mut: |settings_content| {
1754 &mut settings_content
1755 .tab_bar
1756 .get_or_insert_default()
1757 .show_nav_history_buttons
1758 },
1759 }),
1760 metadata: None,
1761 files: USER,
1762 }),
1763 SettingsPageItem::SectionHeader("Title Bar"),
1764 SettingsPageItem::SettingItem(SettingItem {
1765 title: "Show Branch Icon",
1766 description: "Whether to show the branch icon beside branch switcher in the titlebar",
1767 field: Box::new(SettingField {
1768 pick: |settings_content| {
1769 if let Some(title_bar) = &settings_content.title_bar {
1770 &title_bar.show_branch_icon
1771 } else {
1772 &None
1773 }
1774 },
1775 pick_mut: |settings_content| {
1776 &mut settings_content
1777 .title_bar
1778 .get_or_insert_default()
1779 .show_branch_icon
1780 },
1781 }),
1782 metadata: None,
1783 files: USER,
1784 }),
1785 SettingsPageItem::SettingItem(SettingItem {
1786 title: "Show Branch Name",
1787 description: "Whether to show the branch name button in the titlebar",
1788 field: Box::new(SettingField {
1789 pick: |settings_content| {
1790 if let Some(title_bar) = &settings_content.title_bar {
1791 &title_bar.show_branch_name
1792 } else {
1793 &None
1794 }
1795 },
1796 pick_mut: |settings_content| {
1797 &mut settings_content
1798 .title_bar
1799 .get_or_insert_default()
1800 .show_branch_name
1801 },
1802 }),
1803 metadata: None,
1804 files: USER,
1805 }),
1806 SettingsPageItem::SettingItem(SettingItem {
1807 title: "Show Project Items",
1808 description: "Whether to show the project host and name in the titlebar",
1809 field: Box::new(SettingField {
1810 pick: |settings_content| {
1811 if let Some(title_bar) = &settings_content.title_bar {
1812 &title_bar.show_project_items
1813 } else {
1814 &None
1815 }
1816 },
1817 pick_mut: |settings_content| {
1818 &mut settings_content
1819 .title_bar
1820 .get_or_insert_default()
1821 .show_project_items
1822 },
1823 }),
1824 metadata: None,
1825 files: USER,
1826 }),
1827 SettingsPageItem::SettingItem(SettingItem {
1828 title: "Show Onboarding Banner",
1829 description: "Whether to show onboarding banners in the titlebar",
1830 field: Box::new(SettingField {
1831 pick: |settings_content| {
1832 if let Some(title_bar) = &settings_content.title_bar {
1833 &title_bar.show_onboarding_banner
1834 } else {
1835 &None
1836 }
1837 },
1838 pick_mut: |settings_content| {
1839 &mut settings_content
1840 .title_bar
1841 .get_or_insert_default()
1842 .show_onboarding_banner
1843 },
1844 }),
1845 metadata: None,
1846 files: USER,
1847 }),
1848 SettingsPageItem::SettingItem(SettingItem {
1849 title: "Show User Picture",
1850 description: "Whether to show user picture in the titlebar",
1851 field: Box::new(SettingField {
1852 pick: |settings_content| {
1853 if let Some(title_bar) = &settings_content.title_bar {
1854 &title_bar.show_user_picture
1855 } else {
1856 &None
1857 }
1858 },
1859 pick_mut: |settings_content| {
1860 &mut settings_content
1861 .title_bar
1862 .get_or_insert_default()
1863 .show_user_picture
1864 },
1865 }),
1866 metadata: None,
1867 files: USER,
1868 }),
1869 SettingsPageItem::SettingItem(SettingItem {
1870 title: "Show Sign In",
1871 description: "Whether to show the sign in button in the titlebar",
1872 field: Box::new(SettingField {
1873 pick: |settings_content| {
1874 if let Some(title_bar) = &settings_content.title_bar {
1875 &title_bar.show_sign_in
1876 } else {
1877 &None
1878 }
1879 },
1880 pick_mut: |settings_content| {
1881 &mut settings_content
1882 .title_bar
1883 .get_or_insert_default()
1884 .show_sign_in
1885 },
1886 }),
1887 metadata: None,
1888 files: USER,
1889 }),
1890 SettingsPageItem::SettingItem(SettingItem {
1891 title: "Show Menus",
1892 description: "Whether to show the menus in the titlebar",
1893 field: Box::new(SettingField {
1894 pick: |settings_content| {
1895 if let Some(title_bar) = &settings_content.title_bar {
1896 &title_bar.show_menus
1897 } else {
1898 &None
1899 }
1900 },
1901 pick_mut: |settings_content| {
1902 &mut settings_content
1903 .title_bar
1904 .get_or_insert_default()
1905 .show_menus
1906 },
1907 }),
1908 metadata: None,
1909 files: USER,
1910 }),
1911 SettingsPageItem::SectionHeader("Tab Settings"),
1912 SettingsPageItem::SettingItem(SettingItem {
1913 title: "Activate On Close",
1914 description: "What to do after closing the current tab",
1915 field: Box::new(SettingField {
1916 pick: |settings_content| {
1917 if let Some(tabs) = &settings_content.tabs {
1918 &tabs.activate_on_close
1919 } else {
1920 &None
1921 }
1922 },
1923 pick_mut: |settings_content| {
1924 &mut settings_content
1925 .tabs
1926 .get_or_insert_default()
1927 .activate_on_close
1928 },
1929 }),
1930 metadata: None,
1931 files: USER,
1932 }),
1933 SettingsPageItem::SettingItem(SettingItem {
1934 title: "Tab Show Diagnostics",
1935 description: "Which files containing diagnostic errors/warnings to mark in the tabs",
1936 field: Box::new(SettingField {
1937 pick: |settings_content| {
1938 if let Some(tabs) = &settings_content.tabs {
1939 &tabs.show_diagnostics
1940 } else {
1941 &None
1942 }
1943 },
1944 pick_mut: |settings_content| {
1945 &mut settings_content
1946 .tabs
1947 .get_or_insert_default()
1948 .show_diagnostics
1949 },
1950 }),
1951 metadata: None,
1952 files: USER,
1953 }),
1954 SettingsPageItem::SettingItem(SettingItem {
1955 title: "Show Close Button",
1956 description: "Controls the appearance behavior of the tab's close button",
1957 field: Box::new(SettingField {
1958 pick: |settings_content| {
1959 if let Some(tabs) = &settings_content.tabs {
1960 &tabs.show_close_button
1961 } else {
1962 &None
1963 }
1964 },
1965 pick_mut: |settings_content| {
1966 &mut settings_content
1967 .tabs
1968 .get_or_insert_default()
1969 .show_close_button
1970 },
1971 }),
1972 metadata: None,
1973 files: USER,
1974 }),
1975 SettingsPageItem::SectionHeader("Preview Tabs"),
1976 SettingsPageItem::SettingItem(SettingItem {
1977 title: "Preview Tabs Enabled",
1978 description: "Whether to show opened editors as preview tabs",
1979 field: Box::new(SettingField {
1980 pick: |settings_content| {
1981 if let Some(preview_tabs) = &settings_content.preview_tabs {
1982 &preview_tabs.enabled
1983 } else {
1984 &None
1985 }
1986 },
1987 pick_mut: |settings_content| {
1988 &mut settings_content
1989 .preview_tabs
1990 .get_or_insert_default()
1991 .enabled
1992 },
1993 }),
1994 metadata: None,
1995 files: USER,
1996 }),
1997 SettingsPageItem::SettingItem(SettingItem {
1998 title: "Enable Preview From File Finder",
1999 description: "Whether to open tabs in preview mode when selected from the file finder",
2000 field: Box::new(SettingField {
2001 pick: |settings_content| {
2002 if let Some(preview_tabs) = &settings_content.preview_tabs {
2003 &preview_tabs.enable_preview_from_file_finder
2004 } else {
2005 &None
2006 }
2007 },
2008 pick_mut: |settings_content| {
2009 &mut settings_content
2010 .preview_tabs
2011 .get_or_insert_default()
2012 .enable_preview_from_file_finder
2013 },
2014 }),
2015 metadata: None,
2016 files: USER,
2017 }),
2018 SettingsPageItem::SettingItem(SettingItem {
2019 title: "Enable Preview From Code Navigation",
2020 description: "Whether a preview tab gets replaced when code navigation is used to navigate away from the tab",
2021 field: Box::new(SettingField {
2022 pick: |settings_content| {
2023 if let Some(preview_tabs) = &settings_content.preview_tabs {
2024 &preview_tabs.enable_preview_from_code_navigation
2025 } else {
2026 &None
2027 }
2028 },
2029 pick_mut: |settings_content| {
2030 &mut settings_content
2031 .preview_tabs
2032 .get_or_insert_default()
2033 .enable_preview_from_code_navigation
2034 },
2035 }),
2036 metadata: None,
2037 files: USER,
2038 }),
2039 SettingsPageItem::SectionHeader("Search Settings"),
2040 SettingsPageItem::SettingItem(SettingItem {
2041 title: "Whole Word",
2042 description: "Whether to search for whole words by default",
2043 field: Box::new(SettingField {
2044 pick: |settings_content| {
2045 if let Some(search) = &settings_content.editor.search {
2046 &search.whole_word
2047 } else {
2048 &None
2049 }
2050 },
2051 pick_mut: |settings_content| {
2052 &mut settings_content
2053 .editor
2054 .search
2055 .get_or_insert_default()
2056 .whole_word
2057 },
2058 }),
2059 metadata: None,
2060 files: USER,
2061 }),
2062 SettingsPageItem::SettingItem(SettingItem {
2063 title: "Case Sensitive",
2064 description: "Whether to search case-sensitively by default",
2065 field: Box::new(SettingField {
2066 pick: |settings_content| {
2067 if let Some(search) = &settings_content.editor.search {
2068 &search.case_sensitive
2069 } else {
2070 &None
2071 }
2072 },
2073 pick_mut: |settings_content| {
2074 &mut settings_content
2075 .editor
2076 .search
2077 .get_or_insert_default()
2078 .case_sensitive
2079 },
2080 }),
2081 metadata: None,
2082 files: USER,
2083 }),
2084 SettingsPageItem::SettingItem(SettingItem {
2085 title: "Include Ignored",
2086 description: "Whether to include ignored files in search results by default",
2087 field: Box::new(SettingField {
2088 pick: |settings_content| {
2089 if let Some(search) = &settings_content.editor.search {
2090 &search.include_ignored
2091 } else {
2092 &None
2093 }
2094 },
2095 pick_mut: |settings_content| {
2096 &mut settings_content
2097 .editor
2098 .search
2099 .get_or_insert_default()
2100 .include_ignored
2101 },
2102 }),
2103 metadata: None,
2104 files: USER,
2105 }),
2106 SettingsPageItem::SettingItem(SettingItem {
2107 title: "Regex",
2108 description: "Whether to use regex search by default",
2109 field: Box::new(SettingField {
2110 pick: |settings_content| {
2111 if let Some(search) = &settings_content.editor.search {
2112 &search.regex
2113 } else {
2114 &None
2115 }
2116 },
2117 pick_mut: |settings_content| {
2118 &mut settings_content.editor.search.get_or_insert_default().regex
2119 },
2120 }),
2121 metadata: None,
2122 files: USER,
2123 }),
2124 SettingsPageItem::SectionHeader("File Finder"),
2125 SettingsPageItem::SettingItem(SettingItem {
2126 title: "File Icons",
2127 description: "Whether to show file icons in the file finder",
2128 field: Box::new(SettingField {
2129 pick: |settings_content| {
2130 if let Some(file_finder) = &settings_content.file_finder {
2131 &file_finder.file_icons
2132 } else {
2133 &None
2134 }
2135 },
2136 pick_mut: |settings_content| {
2137 &mut settings_content
2138 .file_finder
2139 .get_or_insert_default()
2140 .file_icons
2141 },
2142 }),
2143 metadata: None,
2144 files: USER,
2145 }),
2146 SettingsPageItem::SettingItem(SettingItem {
2147 title: "Modal Max Width",
2148 description: "Determines how much space the file finder can take up in relation to the available window width",
2149 field: Box::new(SettingField {
2150 pick: |settings_content| {
2151 if let Some(file_finder) = &settings_content.file_finder {
2152 &file_finder.modal_max_width
2153 } else {
2154 &None
2155 }
2156 },
2157 pick_mut: |settings_content| {
2158 &mut settings_content
2159 .file_finder
2160 .get_or_insert_default()
2161 .modal_max_width
2162 },
2163 }),
2164 metadata: None,
2165 files: USER,
2166 }),
2167 SettingsPageItem::SettingItem(SettingItem {
2168 title: "Skip Focus For Active In Search",
2169 description: "Whether the file finder should skip focus for the active file in search results",
2170 field: Box::new(SettingField {
2171 pick: |settings_content| {
2172 if let Some(file_finder) = &settings_content.file_finder {
2173 &file_finder.skip_focus_for_active_in_search
2174 } else {
2175 &None
2176 }
2177 },
2178 pick_mut: |settings_content| {
2179 &mut settings_content
2180 .file_finder
2181 .get_or_insert_default()
2182 .skip_focus_for_active_in_search
2183 },
2184 }),
2185 metadata: None,
2186 files: USER,
2187 }),
2188 SettingsPageItem::SettingItem(SettingItem {
2189 title: "Git Status",
2190 description: "Whether to show the git status in the file finder",
2191 field: Box::new(SettingField {
2192 pick: |settings_content| {
2193 if let Some(file_finder) = &settings_content.file_finder {
2194 &file_finder.git_status
2195 } else {
2196 &None
2197 }
2198 },
2199 pick_mut: |settings_content| {
2200 &mut settings_content
2201 .file_finder
2202 .get_or_insert_default()
2203 .git_status
2204 },
2205 }),
2206 metadata: None,
2207 files: USER,
2208 }),
2209 // todo: null by default
2210 // files: USER,
2211 // SettingsPageItem::SettingItem(SettingItem {
2212 // title: "Include Ignored",
2213 // description: "Whether to use gitignored files when searching",
2214 // field: Box::new(SettingField {
2215 // pick: |settings_content| {
2216 // if let Some(file_finder) = &settings_content.file_finder {
2217 // &file_finder.include_ignored
2218 // } else {
2219 // &None
2220 // }
2221 // },
2222 // pick_mut: |settings_content| {
2223 // &mut settings_content
2224 // .file_finder
2225 // .get_or_insert_default()
2226 // .include_ignored
2227 // },
2228 // }),
2229 // metadata: None,
2230 // }),
2231 ],
2232 },
2233 SettingsPage {
2234 title: "Panels",
2235 items: vec![
2236 SettingsPageItem::SectionHeader("Project Panel"),
2237 SettingsPageItem::SettingItem(SettingItem {
2238 title: "Project Panel Button",
2239 description: "Whether to show the project panel button in the status bar",
2240 field: Box::new(SettingField {
2241 pick: |settings_content| {
2242 if let Some(project_panel) = &settings_content.project_panel {
2243 &project_panel.button
2244 } else {
2245 &None
2246 }
2247 },
2248 pick_mut: |settings_content| {
2249 &mut settings_content
2250 .project_panel
2251 .get_or_insert_default()
2252 .button
2253 },
2254 }),
2255 metadata: None,
2256 files: USER,
2257 }),
2258 SettingsPageItem::SettingItem(SettingItem {
2259 title: "Project Panel Dock",
2260 description: "Where to dock the project panel",
2261 field: Box::new(SettingField {
2262 pick: |settings_content| {
2263 if let Some(project_panel) = &settings_content.project_panel {
2264 &project_panel.dock
2265 } else {
2266 &None
2267 }
2268 },
2269 pick_mut: |settings_content| {
2270 &mut settings_content.project_panel.get_or_insert_default().dock
2271 },
2272 }),
2273 metadata: None,
2274 files: USER,
2275 }),
2276 SettingsPageItem::SettingItem(SettingItem {
2277 title: "Project Panel Default Width",
2278 description: "Default width of the project panel in pixels",
2279 field: Box::new(SettingField {
2280 pick: |settings_content| {
2281 if let Some(project_panel) = &settings_content.project_panel {
2282 &project_panel.default_width
2283 } else {
2284 &None
2285 }
2286 },
2287 pick_mut: |settings_content| {
2288 &mut settings_content
2289 .project_panel
2290 .get_or_insert_default()
2291 .default_width
2292 },
2293 }),
2294 metadata: None,
2295 files: USER,
2296 }),
2297 SettingsPageItem::SettingItem(SettingItem {
2298 title: "Hide .gitignore",
2299 description: "Whether to hide the gitignore entries in the project panel",
2300 field: Box::new(SettingField {
2301 pick: |settings_content| {
2302 if let Some(project_panel) = &settings_content.project_panel {
2303 &project_panel.hide_gitignore
2304 } else {
2305 &None
2306 }
2307 },
2308 pick_mut: |settings_content| {
2309 &mut settings_content
2310 .project_panel
2311 .get_or_insert_default()
2312 .hide_gitignore
2313 },
2314 }),
2315 metadata: None,
2316 files: USER,
2317 }),
2318 SettingsPageItem::SettingItem(SettingItem {
2319 title: "Entry Spacing",
2320 description: "Spacing between worktree entries in the project panel",
2321 field: Box::new(SettingField {
2322 pick: |settings_content| {
2323 if let Some(project_panel) = &settings_content.project_panel {
2324 &project_panel.entry_spacing
2325 } else {
2326 &None
2327 }
2328 },
2329 pick_mut: |settings_content| {
2330 &mut settings_content
2331 .project_panel
2332 .get_or_insert_default()
2333 .entry_spacing
2334 },
2335 }),
2336 metadata: None,
2337 files: USER,
2338 }),
2339 SettingsPageItem::SettingItem(SettingItem {
2340 title: "File Icons",
2341 description: "Whether to show folder icons or chevrons for directories in the project panel",
2342 field: Box::new(SettingField {
2343 pick: |settings_content| {
2344 if let Some(project_panel) = &settings_content.project_panel {
2345 &project_panel.file_icons
2346 } else {
2347 &None
2348 }
2349 },
2350 pick_mut: |settings_content| {
2351 &mut settings_content
2352 .project_panel
2353 .get_or_insert_default()
2354 .file_icons
2355 },
2356 }),
2357 metadata: None,
2358 files: USER,
2359 }),
2360 SettingsPageItem::SettingItem(SettingItem {
2361 title: "Folder Icons",
2362 description: "Whether to show folder icons or chevrons for directories in the project panel",
2363 field: Box::new(SettingField {
2364 pick: |settings_content| {
2365 if let Some(project_panel) = &settings_content.project_panel {
2366 &project_panel.folder_icons
2367 } else {
2368 &None
2369 }
2370 },
2371 pick_mut: |settings_content| {
2372 &mut settings_content
2373 .project_panel
2374 .get_or_insert_default()
2375 .folder_icons
2376 },
2377 }),
2378 metadata: None,
2379 files: USER,
2380 }),
2381 SettingsPageItem::SettingItem(SettingItem {
2382 title: "Git Status",
2383 description: "Whether to show the git status in the project panel",
2384 field: Box::new(SettingField {
2385 pick: |settings_content| {
2386 if let Some(project_panel) = &settings_content.project_panel {
2387 &project_panel.git_status
2388 } else {
2389 &None
2390 }
2391 },
2392 pick_mut: |settings_content| {
2393 &mut settings_content
2394 .project_panel
2395 .get_or_insert_default()
2396 .git_status
2397 },
2398 }),
2399 metadata: None,
2400 files: USER,
2401 }),
2402 SettingsPageItem::SettingItem(SettingItem {
2403 title: "Indent Size",
2404 description: "Amount of indentation for nested items",
2405 field: Box::new(SettingField {
2406 pick: |settings_content| {
2407 if let Some(project_panel) = &settings_content.project_panel {
2408 &project_panel.indent_size
2409 } else {
2410 &None
2411 }
2412 },
2413 pick_mut: |settings_content| {
2414 &mut settings_content
2415 .project_panel
2416 .get_or_insert_default()
2417 .indent_size
2418 },
2419 }),
2420 metadata: None,
2421 files: USER,
2422 }),
2423 SettingsPageItem::SettingItem(SettingItem {
2424 title: "Auto Reveal Entries",
2425 description: "Whether to reveal it in the project panel automatically when a corresponding project entry becomes active",
2426 field: Box::new(SettingField {
2427 pick: |settings_content| {
2428 if let Some(project_panel) = &settings_content.project_panel {
2429 &project_panel.auto_reveal_entries
2430 } else {
2431 &None
2432 }
2433 },
2434 pick_mut: |settings_content| {
2435 &mut settings_content
2436 .project_panel
2437 .get_or_insert_default()
2438 .auto_reveal_entries
2439 },
2440 }),
2441 metadata: None,
2442 files: USER,
2443 }),
2444 SettingsPageItem::SettingItem(SettingItem {
2445 title: "Starts Open",
2446 description: "Whether the project panel should open on startup",
2447 field: Box::new(SettingField {
2448 pick: |settings_content| {
2449 if let Some(project_panel) = &settings_content.project_panel {
2450 &project_panel.starts_open
2451 } else {
2452 &None
2453 }
2454 },
2455 pick_mut: |settings_content| {
2456 &mut settings_content
2457 .project_panel
2458 .get_or_insert_default()
2459 .starts_open
2460 },
2461 }),
2462 metadata: None,
2463 files: USER,
2464 }),
2465 SettingsPageItem::SettingItem(SettingItem {
2466 title: "Auto Fold Directories",
2467 description: "Whether to fold directories automatically and show compact folders when a directory has only one subdirectory inside",
2468 field: Box::new(SettingField {
2469 pick: |settings_content| {
2470 if let Some(project_panel) = &settings_content.project_panel {
2471 &project_panel.auto_fold_dirs
2472 } else {
2473 &None
2474 }
2475 },
2476 pick_mut: |settings_content| {
2477 &mut settings_content
2478 .project_panel
2479 .get_or_insert_default()
2480 .auto_fold_dirs
2481 },
2482 }),
2483 metadata: None,
2484 files: USER,
2485 }),
2486 // files: USER,
2487 // SettingsPageItem::SettingItem(SettingItem {
2488 // title: "Scrollbar Show",
2489 // description: "When to show the scrollbar in the project panel",
2490 // field: Box::new(SettingField {
2491 // pick: |settings_content| {
2492 // if let Some(project_panel) = &settings_content.project_panel {
2493 // if let Some(scrollbar) = &project_panel.scrollbar {
2494 // &scrollbar.show
2495 // } else {
2496 // &None
2497 // }
2498 // } else {
2499 // &None
2500 // }
2501 // },
2502 // pick_mut: |settings_content| {
2503 // &mut settings_content
2504 // .project_panel
2505 // .get_or_insert_default()
2506 // .scrollbar
2507 // },
2508 // }),
2509 // metadata: None,
2510 // }),
2511 SettingsPageItem::SettingItem(SettingItem {
2512 title: "Show Diagnostics",
2513 description: "Which files containing diagnostic errors/warnings to mark in the project panel",
2514 field: Box::new(SettingField {
2515 pick: |settings_content| {
2516 if let Some(project_panel) = &settings_content.project_panel {
2517 &project_panel.show_diagnostics
2518 } else {
2519 &None
2520 }
2521 },
2522 pick_mut: |settings_content| {
2523 &mut settings_content
2524 .project_panel
2525 .get_or_insert_default()
2526 .show_diagnostics
2527 },
2528 }),
2529 metadata: None,
2530 files: USER,
2531 }),
2532 SettingsPageItem::SettingItem(SettingItem {
2533 title: "Sticky Scroll",
2534 description: "Whether to stick parent directories at top of the project panel",
2535 field: Box::new(SettingField {
2536 pick: |settings_content| {
2537 if let Some(project_panel) = &settings_content.project_panel {
2538 &project_panel.sticky_scroll
2539 } else {
2540 &None
2541 }
2542 },
2543 pick_mut: |settings_content| {
2544 &mut settings_content
2545 .project_panel
2546 .get_or_insert_default()
2547 .sticky_scroll
2548 },
2549 }),
2550 metadata: None,
2551 files: USER,
2552 }),
2553 // files: USER,
2554 // SettingsPageItem::SettingItem(SettingItem {
2555 // title: "Indent Guides Show",
2556 // description: "When to show indent guides in the project panel",
2557 // field: Box::new(SettingField {
2558 // pick: |settings_content| {
2559 // if let Some(project_panel) = &settings_content.project_panel {
2560 // if let Some(indent_guides) = &project_panel.indent_guides {
2561 // &indent_guides.show
2562 // } else {
2563 // &None
2564 // }
2565 // } else {
2566 // &None
2567 // }
2568 // },
2569 // pick_mut: |settings_content| {
2570 // &mut settings_content
2571 // .project_panel
2572 // .get_or_insert_default()
2573 // .indent_guides
2574 // .get_or_insert_default()
2575 // .show
2576 // },
2577 // }),
2578 // metadata: None,
2579 // }),
2580 SettingsPageItem::SettingItem(SettingItem {
2581 title: "Drag and Drop",
2582 description: "Whether to enable drag-and-drop operations in the project panel",
2583 field: Box::new(SettingField {
2584 pick: |settings_content| {
2585 if let Some(project_panel) = &settings_content.project_panel {
2586 &project_panel.drag_and_drop
2587 } else {
2588 &None
2589 }
2590 },
2591 pick_mut: |settings_content| {
2592 &mut settings_content
2593 .project_panel
2594 .get_or_insert_default()
2595 .drag_and_drop
2596 },
2597 }),
2598 metadata: None,
2599 files: USER,
2600 }),
2601 SettingsPageItem::SettingItem(SettingItem {
2602 title: "Hide Root",
2603 description: "Whether to hide the root entry when only one folder is open in the window",
2604 field: Box::new(SettingField {
2605 pick: |settings_content| {
2606 if let Some(project_panel) = &settings_content.project_panel {
2607 &project_panel.hide_root
2608 } else {
2609 &None
2610 }
2611 },
2612 pick_mut: |settings_content| {
2613 &mut settings_content
2614 .project_panel
2615 .get_or_insert_default()
2616 .hide_root
2617 },
2618 }),
2619 metadata: None,
2620 files: USER,
2621 }),
2622 SettingsPageItem::SectionHeader("Terminal Panel"),
2623 SettingsPageItem::SettingItem(SettingItem {
2624 title: "Terminal Dock",
2625 description: "Where to dock the terminal panel",
2626 field: Box::new(SettingField {
2627 pick: |settings_content| {
2628 if let Some(terminal) = &settings_content.terminal {
2629 &terminal.dock
2630 } else {
2631 &None
2632 }
2633 },
2634 pick_mut: |settings_content| {
2635 &mut settings_content.terminal.get_or_insert_default().dock
2636 },
2637 }),
2638 metadata: None,
2639 files: USER,
2640 }),
2641 SettingsPageItem::SettingItem(SettingItem {
2642 title: "Default Width",
2643 description: "Default width when the terminal is docked to the left or right",
2644 field: Box::new(SettingField {
2645 pick: |settings_content| {
2646 if let Some(terminal) = &settings_content.terminal {
2647 &terminal.default_width
2648 } else {
2649 &None
2650 }
2651 },
2652 pick_mut: |settings_content| {
2653 &mut settings_content
2654 .terminal
2655 .get_or_insert_default()
2656 .default_width
2657 },
2658 }),
2659 metadata: None,
2660 }),
2661 SettingsPageItem::SettingItem(SettingItem {
2662 title: "Default Height",
2663 description: "Default height when the terminal is docked to the bottom",
2664 field: Box::new(SettingField {
2665 pick: |settings_content| {
2666 if let Some(terminal) = &settings_content.terminal {
2667 &terminal.default_height
2668 } else {
2669 &None
2670 }
2671 },
2672 pick_mut: |settings_content| {
2673 &mut settings_content
2674 .terminal
2675 .get_or_insert_default()
2676 .default_height
2677 },
2678 }),
2679 metadata: None,
2680 }),
2681 SettingsPageItem::SettingItem(SettingItem {
2682 title: "Blinking",
2683 description: "Sets the cursor blinking behavior in the terminal",
2684 field: Box::new(SettingField {
2685 pick: |settings_content| {
2686 if let Some(terminal) = &settings_content.terminal {
2687 &terminal.blinking
2688 } else {
2689 &None
2690 }
2691 },
2692 pick_mut: |settings_content| {
2693 &mut settings_content.terminal.get_or_insert_default().blinking
2694 },
2695 }),
2696 metadata: None,
2697 }),
2698 SettingsPageItem::SettingItem(SettingItem {
2699 title: "Cursor Shape",
2700 description: "Default cursor shape for the terminal",
2701 field: Box::new(SettingField {
2702 pick: |settings_content| {
2703 if let Some(terminal) = &settings_content.terminal {
2704 &terminal.cursor_shape
2705 } else {
2706 &None
2707 }
2708 },
2709 pick_mut: |settings_content| {
2710 &mut settings_content
2711 .terminal
2712 .get_or_insert_default()
2713 .cursor_shape
2714 },
2715 }),
2716 metadata: None,
2717 }),
2718 SettingsPageItem::SettingItem(SettingItem {
2719 title: "Alternate Scroll",
2720 description: "Sets whether Alternate Scroll mode is active by default",
2721 field: Box::new(SettingField {
2722 pick: |settings_content| {
2723 if let Some(terminal) = &settings_content.terminal {
2724 &terminal.alternate_scroll
2725 } else {
2726 &None
2727 }
2728 },
2729 pick_mut: |settings_content| {
2730 &mut settings_content
2731 .terminal
2732 .get_or_insert_default()
2733 .alternate_scroll
2734 },
2735 }),
2736 metadata: None,
2737 }),
2738 SettingsPageItem::SettingItem(SettingItem {
2739 title: "Option As Meta",
2740 description: "Sets whether the option key behaves as the meta key",
2741 field: Box::new(SettingField {
2742 pick: |settings_content| {
2743 if let Some(terminal) = &settings_content.terminal {
2744 &terminal.option_as_meta
2745 } else {
2746 &None
2747 }
2748 },
2749 pick_mut: |settings_content| {
2750 &mut settings_content
2751 .terminal
2752 .get_or_insert_default()
2753 .option_as_meta
2754 },
2755 }),
2756 metadata: None,
2757 }),
2758 SettingsPageItem::SettingItem(SettingItem {
2759 title: "Copy On Select",
2760 description: "Whether selecting text in the terminal automatically copies to clipboard",
2761 field: Box::new(SettingField {
2762 pick: |settings_content| {
2763 if let Some(terminal) = &settings_content.terminal {
2764 &terminal.copy_on_select
2765 } else {
2766 &None
2767 }
2768 },
2769 pick_mut: |settings_content| {
2770 &mut settings_content
2771 .terminal
2772 .get_or_insert_default()
2773 .copy_on_select
2774 },
2775 }),
2776 metadata: None,
2777 }),
2778 SettingsPageItem::SettingItem(SettingItem {
2779 title: "Keep Selection On Copy",
2780 description: "Whether to keep the text selection after copying it to the clipboard",
2781 field: Box::new(SettingField {
2782 pick: |settings_content| {
2783 if let Some(terminal) = &settings_content.terminal {
2784 &terminal.keep_selection_on_copy
2785 } else {
2786 &None
2787 }
2788 },
2789 pick_mut: |settings_content| {
2790 &mut settings_content
2791 .terminal
2792 .get_or_insert_default()
2793 .keep_selection_on_copy
2794 },
2795 }),
2796 metadata: None,
2797 }),
2798 SettingsPageItem::SettingItem(SettingItem {
2799 title: "Max Scroll History Lines",
2800 description: "The maximum number of lines to keep in the scrollback history",
2801 field: Box::new(SettingField {
2802 pick: |settings_content| {
2803 if let Some(terminal) = &settings_content.terminal {
2804 &terminal.max_scroll_history_lines
2805 } else {
2806 &None
2807 }
2808 },
2809 pick_mut: |settings_content| {
2810 &mut settings_content
2811 .terminal
2812 .get_or_insert_default()
2813 .max_scroll_history_lines
2814 },
2815 }),
2816 metadata: None,
2817 }),
2818 SettingsPageItem::SectionHeader("Outline Panel"),
2819 SettingsPageItem::SettingItem(SettingItem {
2820 title: "Outline Panel Button",
2821 description: "Whether to show the outline panel button in the status bar",
2822 field: Box::new(SettingField {
2823 pick: |settings_content| {
2824 if let Some(outline_panel) = &settings_content.outline_panel {
2825 &outline_panel.button
2826 } else {
2827 &None
2828 }
2829 },
2830 pick_mut: |settings_content| {
2831 &mut settings_content
2832 .outline_panel
2833 .get_or_insert_default()
2834 .button
2835 },
2836 }),
2837 metadata: None,
2838 files: USER,
2839 }),
2840 SettingsPageItem::SettingItem(SettingItem {
2841 title: "Outline Panel Dock",
2842 description: "Where to dock the outline panel",
2843 field: Box::new(SettingField {
2844 pick: |settings_content| {
2845 if let Some(outline_panel) = &settings_content.outline_panel {
2846 &outline_panel.dock
2847 } else {
2848 &None
2849 }
2850 },
2851 pick_mut: |settings_content| {
2852 &mut settings_content.outline_panel.get_or_insert_default().dock
2853 },
2854 }),
2855 metadata: None,
2856 files: USER,
2857 }),
2858 SettingsPageItem::SettingItem(SettingItem {
2859 title: "Outline Panel Default Width",
2860 description: "Default width of the outline panel in pixels",
2861 field: Box::new(SettingField {
2862 pick: |settings_content| {
2863 if let Some(outline_panel) = &settings_content.outline_panel {
2864 &outline_panel.default_width
2865 } else {
2866 &None
2867 }
2868 },
2869 pick_mut: |settings_content| {
2870 &mut settings_content
2871 .outline_panel
2872 .get_or_insert_default()
2873 .default_width
2874 },
2875 }),
2876 metadata: None,
2877 files: USER,
2878 }),
2879 SettingsPageItem::SettingItem(SettingItem {
2880 title: "File Icons",
2881 description: "Whether to show file icons in the outline panel",
2882 field: Box::new(SettingField {
2883 pick: |settings_content| {
2884 if let Some(outline_panel) = &settings_content.outline_panel {
2885 &outline_panel.file_icons
2886 } else {
2887 &None
2888 }
2889 },
2890 pick_mut: |settings_content| {
2891 &mut settings_content
2892 .outline_panel
2893 .get_or_insert_default()
2894 .file_icons
2895 },
2896 }),
2897 metadata: None,
2898 files: USER,
2899 }),
2900 SettingsPageItem::SettingItem(SettingItem {
2901 title: "Folder Icons",
2902 description: "Whether to show folder icons or chevrons for directories in the outline panel",
2903 field: Box::new(SettingField {
2904 pick: |settings_content| {
2905 if let Some(outline_panel) = &settings_content.outline_panel {
2906 &outline_panel.folder_icons
2907 } else {
2908 &None
2909 }
2910 },
2911 pick_mut: |settings_content| {
2912 &mut settings_content
2913 .outline_panel
2914 .get_or_insert_default()
2915 .folder_icons
2916 },
2917 }),
2918 metadata: None,
2919 files: USER,
2920 }),
2921 SettingsPageItem::SettingItem(SettingItem {
2922 title: "Git Status",
2923 description: "Whether to show the git status in the outline panel",
2924 field: Box::new(SettingField {
2925 pick: |settings_content| {
2926 if let Some(outline_panel) = &settings_content.outline_panel {
2927 &outline_panel.git_status
2928 } else {
2929 &None
2930 }
2931 },
2932 pick_mut: |settings_content| {
2933 &mut settings_content
2934 .outline_panel
2935 .get_or_insert_default()
2936 .git_status
2937 },
2938 }),
2939 metadata: None,
2940 files: USER,
2941 }),
2942 SettingsPageItem::SettingItem(SettingItem {
2943 title: "Indent Size",
2944 description: "Amount of indentation for nested items",
2945 field: Box::new(SettingField {
2946 pick: |settings_content| {
2947 if let Some(outline_panel) = &settings_content.outline_panel {
2948 &outline_panel.indent_size
2949 } else {
2950 &None
2951 }
2952 },
2953 pick_mut: |settings_content| {
2954 &mut settings_content
2955 .outline_panel
2956 .get_or_insert_default()
2957 .indent_size
2958 },
2959 }),
2960 metadata: None,
2961 files: USER,
2962 }),
2963 SettingsPageItem::SettingItem(SettingItem {
2964 title: "Auto Reveal Entries",
2965 description: "Whether to reveal when a corresponding outline entry becomes active",
2966 field: Box::new(SettingField {
2967 pick: |settings_content| {
2968 if let Some(outline_panel) = &settings_content.outline_panel {
2969 &outline_panel.auto_reveal_entries
2970 } else {
2971 &None
2972 }
2973 },
2974 pick_mut: |settings_content| {
2975 &mut settings_content
2976 .outline_panel
2977 .get_or_insert_default()
2978 .auto_reveal_entries
2979 },
2980 }),
2981 metadata: None,
2982 files: USER,
2983 }),
2984 SettingsPageItem::SettingItem(SettingItem {
2985 title: "Auto Fold Directories",
2986 description: "Whether to fold directories automatically when a directory has only one directory inside",
2987 field: Box::new(SettingField {
2988 pick: |settings_content| {
2989 if let Some(outline_panel) = &settings_content.outline_panel {
2990 &outline_panel.auto_fold_dirs
2991 } else {
2992 &None
2993 }
2994 },
2995 pick_mut: |settings_content| {
2996 &mut settings_content
2997 .outline_panel
2998 .get_or_insert_default()
2999 .auto_fold_dirs
3000 },
3001 }),
3002 metadata: None,
3003 files: USER,
3004 }),
3005 // files: USER,
3006 // SettingsPageItem::SettingItem(SettingItem {
3007 // title: "Indent Guides Show",
3008 // description: "When to show indent guides in the outline panel",
3009 // field: Box::new(SettingField {
3010 // pick: |settings_content| {
3011 // if let Some(outline_panel) = &settings_content.outline_panel {
3012 // if let Some(indent_guides) = &outline_panel.indent_guides {
3013 // &indent_guides.show
3014 // } else {
3015 // &None
3016 // }
3017 // } else {
3018 // &None
3019 // }
3020 // },
3021 // pick_mut: |settings_content| {
3022 // &mut settings_content
3023 // .outline_panel
3024 // .get_or_insert_default()
3025 // .indent_guides
3026 // .get_or_insert_default()
3027 // .show
3028 // },
3029 // }),
3030 // metadata: None,
3031 // }),
3032 SettingsPageItem::SectionHeader("Git Panel"),
3033 SettingsPageItem::SettingItem(SettingItem {
3034 title: "Button",
3035 description: "Whether to show the git panel button in the status bar",
3036 field: Box::new(SettingField {
3037 pick: |settings_content| {
3038 if let Some(git_panel) = &settings_content.git_panel {
3039 &git_panel.button
3040 } else {
3041 &None
3042 }
3043 },
3044 pick_mut: |settings_content| {
3045 &mut settings_content.git_panel.get_or_insert_default().button
3046 },
3047 }),
3048 metadata: None,
3049 files: USER,
3050 }),
3051 SettingsPageItem::SettingItem(SettingItem {
3052 title: "Dock",
3053 description: "Where to dock the git panel",
3054 field: Box::new(SettingField {
3055 pick: |settings_content| {
3056 if let Some(git_panel) = &settings_content.git_panel {
3057 &git_panel.dock
3058 } else {
3059 &None
3060 }
3061 },
3062 pick_mut: |settings_content| {
3063 &mut settings_content.git_panel.get_or_insert_default().dock
3064 },
3065 }),
3066 metadata: None,
3067 files: USER,
3068 }),
3069 SettingsPageItem::SettingItem(SettingItem {
3070 title: "Default Width",
3071 description: "Default width of the git panel in pixels",
3072 field: Box::new(SettingField {
3073 pick: |settings_content| {
3074 if let Some(git_panel) = &settings_content.git_panel {
3075 &git_panel.default_width
3076 } else {
3077 &None
3078 }
3079 },
3080 pick_mut: |settings_content| {
3081 &mut settings_content
3082 .git_panel
3083 .get_or_insert_default()
3084 .default_width
3085 },
3086 }),
3087 metadata: None,
3088 files: USER,
3089 }),
3090 SettingsPageItem::SectionHeader("Notification Panel"),
3091 SettingsPageItem::SettingItem(SettingItem {
3092 title: "Notification Panel Button",
3093 description: "Whether to show the notification panel button in the status bar",
3094 field: Box::new(SettingField {
3095 pick: |settings_content| {
3096 if let Some(notification_panel) = &settings_content.notification_panel {
3097 ¬ification_panel.button
3098 } else {
3099 &None
3100 }
3101 },
3102 pick_mut: |settings_content| {
3103 &mut settings_content
3104 .notification_panel
3105 .get_or_insert_default()
3106 .button
3107 },
3108 }),
3109 metadata: None,
3110 files: USER,
3111 }),
3112 SettingsPageItem::SettingItem(SettingItem {
3113 title: "Notification Panel Dock",
3114 description: "Where to dock the notification panel",
3115 field: Box::new(SettingField {
3116 pick: |settings_content| {
3117 if let Some(notification_panel) = &settings_content.notification_panel {
3118 ¬ification_panel.dock
3119 } else {
3120 &None
3121 }
3122 },
3123 pick_mut: |settings_content| {
3124 &mut settings_content
3125 .notification_panel
3126 .get_or_insert_default()
3127 .dock
3128 },
3129 }),
3130 metadata: None,
3131 files: USER,
3132 }),
3133 SettingsPageItem::SettingItem(SettingItem {
3134 title: "Notification Panel Default Width",
3135 description: "Default width of the notification panel in pixels",
3136 field: Box::new(SettingField {
3137 pick: |settings_content| {
3138 if let Some(notification_panel) = &settings_content.notification_panel {
3139 ¬ification_panel.default_width
3140 } else {
3141 &None
3142 }
3143 },
3144 pick_mut: |settings_content| {
3145 &mut settings_content
3146 .notification_panel
3147 .get_or_insert_default()
3148 .default_width
3149 },
3150 }),
3151 metadata: None,
3152 files: USER,
3153 }),
3154 SettingsPageItem::SectionHeader("Collaboration Panel"),
3155 SettingsPageItem::SettingItem(SettingItem {
3156 title: "Collaboration Panel Button",
3157 description: "Whether to show the collaboration panel button in the status bar",
3158 field: Box::new(SettingField {
3159 pick: |settings_content| {
3160 if let Some(collaboration_panel) = &settings_content.collaboration_panel
3161 {
3162 &collaboration_panel.button
3163 } else {
3164 &None
3165 }
3166 },
3167 pick_mut: |settings_content| {
3168 &mut settings_content
3169 .collaboration_panel
3170 .get_or_insert_default()
3171 .button
3172 },
3173 }),
3174 metadata: None,
3175 files: USER,
3176 }),
3177 SettingsPageItem::SettingItem(SettingItem {
3178 title: "Collaboration Panel Dock",
3179 description: "Where to dock the collaboration panel",
3180 field: Box::new(SettingField {
3181 pick: |settings_content| {
3182 if let Some(collaboration_panel) = &settings_content.collaboration_panel
3183 {
3184 &collaboration_panel.dock
3185 } else {
3186 &None
3187 }
3188 },
3189 pick_mut: |settings_content| {
3190 &mut settings_content
3191 .collaboration_panel
3192 .get_or_insert_default()
3193 .dock
3194 },
3195 }),
3196 metadata: None,
3197 files: USER,
3198 }),
3199 SettingsPageItem::SettingItem(SettingItem {
3200 title: "Collaboration Panel Default Width",
3201 description: "Default width of the collaboration panel in pixels",
3202 field: Box::new(SettingField {
3203 pick: |settings_content| {
3204 if let Some(collaboration_panel) = &settings_content.collaboration_panel
3205 {
3206 &collaboration_panel.default_width
3207 } else {
3208 &None
3209 }
3210 },
3211 pick_mut: |settings_content| {
3212 &mut settings_content
3213 .collaboration_panel
3214 .get_or_insert_default()
3215 .default_width
3216 },
3217 }),
3218 metadata: None,
3219 files: USER,
3220 }),
3221 ],
3222 },
3223 SettingsPage {
3224 title: "Version Control",
3225 items: vec![
3226 SettingsPageItem::SectionHeader("Git"),
3227 SettingsPageItem::SettingItem(SettingItem {
3228 title: "Git Gutter",
3229 description: "Control whether git status is shown in the editor's gutter",
3230 field: Box::new(SettingField {
3231 pick: |settings_content| {
3232 if let Some(git) = &settings_content.git {
3233 &git.git_gutter
3234 } else {
3235 &None
3236 }
3237 },
3238 pick_mut: |settings_content| {
3239 &mut settings_content.git.get_or_insert_default().git_gutter
3240 },
3241 }),
3242 metadata: None,
3243 files: USER,
3244 }),
3245 // todo(settings_ui): Figure out the right default for this value in default.json
3246 SettingsPageItem::SettingItem(SettingItem {
3247 title: "Gutter Debounce",
3248 description: "Debounce threshold in milliseconds after which changes are reflected in the git gutter",
3249 field: Box::new(SettingField {
3250 pick: |settings_content| {
3251 if let Some(git) = &settings_content.git {
3252 &git.gutter_debounce
3253 } else {
3254 &None
3255 }
3256 },
3257 pick_mut: |settings_content| {
3258 &mut settings_content.git.get_or_insert_default().gutter_debounce
3259 },
3260 }),
3261 metadata: None,
3262 files: USER,
3263 }),
3264 SettingsPageItem::SettingItem(SettingItem {
3265 title: "Inline Git Blame",
3266 description: "Whether or not to show git blame data inline in the currently focused line",
3267 field: Box::new(SettingField {
3268 pick: |settings_content| {
3269 if let Some(git) = &settings_content.git {
3270 if let Some(inline_blame) = &git.inline_blame {
3271 &inline_blame.enabled
3272 } else {
3273 &None
3274 }
3275 } else {
3276 &None
3277 }
3278 },
3279 pick_mut: |settings_content| {
3280 &mut settings_content
3281 .git
3282 .get_or_insert_default()
3283 .inline_blame
3284 .get_or_insert_default()
3285 .enabled
3286 },
3287 }),
3288 metadata: None,
3289 files: USER,
3290 }),
3291 SettingsPageItem::SettingItem(SettingItem {
3292 title: "Inline Git Blame Delay",
3293 description: "The delay after which the inline blame information is shown",
3294 field: Box::new(SettingField {
3295 pick: |settings_content| {
3296 if let Some(git) = &settings_content.git {
3297 if let Some(inline_blame) = &git.inline_blame {
3298 &inline_blame.delay_ms
3299 } else {
3300 &None
3301 }
3302 } else {
3303 &None
3304 }
3305 },
3306 pick_mut: |settings_content| {
3307 &mut settings_content
3308 .git
3309 .get_or_insert_default()
3310 .inline_blame
3311 .get_or_insert_default()
3312 .delay_ms
3313 },
3314 }),
3315 metadata: None,
3316 files: USER,
3317 }),
3318 SettingsPageItem::SettingItem(SettingItem {
3319 title: "Inline Git Blame Padding",
3320 description: "Padding between the end of the source line and the start of the inline blame in columns",
3321 field: Box::new(SettingField {
3322 pick: |settings_content| {
3323 if let Some(git) = &settings_content.git {
3324 if let Some(inline_blame) = &git.inline_blame {
3325 &inline_blame.padding
3326 } else {
3327 &None
3328 }
3329 } else {
3330 &None
3331 }
3332 },
3333 pick_mut: |settings_content| {
3334 &mut settings_content
3335 .git
3336 .get_or_insert_default()
3337 .inline_blame
3338 .get_or_insert_default()
3339 .padding
3340 },
3341 }),
3342 metadata: None,
3343 files: USER,
3344 }),
3345 SettingsPageItem::SettingItem(SettingItem {
3346 title: "Inline Git Blame Min Column",
3347 description: "The minimum column number to show the inline blame information at",
3348 field: Box::new(SettingField {
3349 pick: |settings_content| {
3350 if let Some(git) = &settings_content.git {
3351 if let Some(inline_blame) = &git.inline_blame {
3352 &inline_blame.min_column
3353 } else {
3354 &None
3355 }
3356 } else {
3357 &None
3358 }
3359 },
3360 pick_mut: |settings_content| {
3361 &mut settings_content
3362 .git
3363 .get_or_insert_default()
3364 .inline_blame
3365 .get_or_insert_default()
3366 .min_column
3367 },
3368 }),
3369 metadata: None,
3370 files: USER,
3371 }),
3372 SettingsPageItem::SettingItem(SettingItem {
3373 title: "Show Commit Summary",
3374 description: "Whether to show commit summary as part of the inline blame",
3375 field: Box::new(SettingField {
3376 pick: |settings_content| {
3377 if let Some(git) = &settings_content.git {
3378 if let Some(inline_blame) = &git.inline_blame {
3379 &inline_blame.show_commit_summary
3380 } else {
3381 &None
3382 }
3383 } else {
3384 &None
3385 }
3386 },
3387 pick_mut: |settings_content| {
3388 &mut settings_content
3389 .git
3390 .get_or_insert_default()
3391 .inline_blame
3392 .get_or_insert_default()
3393 .show_commit_summary
3394 },
3395 }),
3396 metadata: None,
3397 files: USER,
3398 }),
3399 SettingsPageItem::SettingItem(SettingItem {
3400 title: "Show Avatar",
3401 description: "Whether to show the avatar of the author of the commit",
3402 field: Box::new(SettingField {
3403 pick: |settings_content| {
3404 if let Some(git) = &settings_content.git {
3405 if let Some(blame) = &git.blame {
3406 &blame.show_avatar
3407 } else {
3408 &None
3409 }
3410 } else {
3411 &None
3412 }
3413 },
3414 pick_mut: |settings_content| {
3415 &mut settings_content
3416 .git
3417 .get_or_insert_default()
3418 .blame
3419 .get_or_insert_default()
3420 .show_avatar
3421 },
3422 }),
3423 metadata: None,
3424 files: USER,
3425 }),
3426 SettingsPageItem::SettingItem(SettingItem {
3427 title: "Show Author Name In Branch Picker",
3428 description: "Whether to show author name as part of the commit information in branch picker",
3429 field: Box::new(SettingField {
3430 pick: |settings_content| {
3431 if let Some(git) = &settings_content.git {
3432 if let Some(branch_picker) = &git.branch_picker {
3433 &branch_picker.show_author_name
3434 } else {
3435 &None
3436 }
3437 } else {
3438 &None
3439 }
3440 },
3441 pick_mut: |settings_content| {
3442 &mut settings_content
3443 .git
3444 .get_or_insert_default()
3445 .branch_picker
3446 .get_or_insert_default()
3447 .show_author_name
3448 },
3449 }),
3450 metadata: None,
3451 files: USER,
3452 }),
3453 SettingsPageItem::SettingItem(SettingItem {
3454 title: "Hunk Style",
3455 description: "How git hunks are displayed visually in the editor",
3456 field: Box::new(SettingField {
3457 pick: |settings_content| {
3458 if let Some(git) = &settings_content.git {
3459 &git.hunk_style
3460 } else {
3461 &None
3462 }
3463 },
3464 pick_mut: |settings_content| {
3465 &mut settings_content.git.get_or_insert_default().hunk_style
3466 },
3467 }),
3468 metadata: None,
3469 files: USER,
3470 }),
3471 ],
3472 },
3473 SettingsPage {
3474 title: "System & Network",
3475 items: vec![
3476 SettingsPageItem::SectionHeader("Network"),
3477 // todo(settings_ui): Proxy needs a default
3478 // files: USER,
3479 // SettingsPageItem::SettingItem(SettingItem {
3480 // title: "Proxy",
3481 // description: "The proxy to use for network requests",
3482 // field: Box::new(SettingField {
3483 // pick: |settings_content| &settings_content.proxy,
3484 // pick_mut: |settings_content| &mut settings_content.proxy,
3485 // }),
3486 // metadata: Some(Box::new(SettingsFieldMetadata {
3487 // placeholder: Some("socks5h://localhost:10808"),
3488 // })),
3489 // }),
3490 SettingsPageItem::SettingItem(SettingItem {
3491 title: "Server URL",
3492 description: "The URL of the Zed server to connect to",
3493 field: Box::new(SettingField {
3494 pick: |settings_content| &settings_content.server_url,
3495 pick_mut: |settings_content| &mut settings_content.server_url,
3496 }),
3497 metadata: Some(Box::new(SettingsFieldMetadata {
3498 placeholder: Some("https://zed.dev"),
3499 })),
3500 files: USER,
3501 }),
3502 SettingsPageItem::SectionHeader("System"),
3503 SettingsPageItem::SettingItem(SettingItem {
3504 title: "Auto Update",
3505 description: "Whether or not to automatically check for updates",
3506 field: Box::new(SettingField {
3507 pick: |settings_content| &settings_content.auto_update,
3508 pick_mut: |settings_content| &mut settings_content.auto_update,
3509 }),
3510 metadata: None,
3511 files: USER,
3512 }),
3513 ],
3514 },
3515 SettingsPage {
3516 title: "Diagnostics & Errors",
3517 items: vec![
3518 SettingsPageItem::SectionHeader("Filtering"),
3519 SettingsPageItem::SettingItem(SettingItem {
3520 title: "Max Severity",
3521 description: "Which level to use to filter out diagnostics displayed in the editor",
3522 field: Box::new(SettingField {
3523 pick: |settings_content| &settings_content.editor.diagnostics_max_severity,
3524 pick_mut: |settings_content| {
3525 &mut settings_content.editor.diagnostics_max_severity
3526 },
3527 }),
3528 metadata: None,
3529 files: USER,
3530 }),
3531 SettingsPageItem::SettingItem(SettingItem {
3532 title: "Include Warnings",
3533 description: "Whether to show warnings or not by default",
3534 field: Box::new(SettingField {
3535 pick: |settings_content| {
3536 if let Some(diagnostics) = &settings_content.diagnostics {
3537 &diagnostics.include_warnings
3538 } else {
3539 &None
3540 }
3541 },
3542 pick_mut: |settings_content| {
3543 &mut settings_content
3544 .diagnostics
3545 .get_or_insert_default()
3546 .include_warnings
3547 },
3548 }),
3549 metadata: None,
3550 files: USER,
3551 }),
3552 SettingsPageItem::SectionHeader("Inline"),
3553 SettingsPageItem::SettingItem(SettingItem {
3554 title: "Inline Diagnostics Enabled",
3555 description: "Whether to show diagnostics inline or not",
3556 field: Box::new(SettingField {
3557 pick: |settings_content| {
3558 if let Some(diagnostics) = &settings_content.diagnostics {
3559 if let Some(inline) = &diagnostics.inline {
3560 &inline.enabled
3561 } else {
3562 &None
3563 }
3564 } else {
3565 &None
3566 }
3567 },
3568 pick_mut: |settings_content| {
3569 &mut settings_content
3570 .diagnostics
3571 .get_or_insert_default()
3572 .inline
3573 .get_or_insert_default()
3574 .enabled
3575 },
3576 }),
3577 metadata: None,
3578 files: USER,
3579 }),
3580 SettingsPageItem::SettingItem(SettingItem {
3581 title: "Inline Update Debounce",
3582 description: "The delay in milliseconds to show inline diagnostics after the last diagnostic update",
3583 field: Box::new(SettingField {
3584 pick: |settings_content| {
3585 if let Some(diagnostics) = &settings_content.diagnostics {
3586 if let Some(inline) = &diagnostics.inline {
3587 &inline.update_debounce_ms
3588 } else {
3589 &None
3590 }
3591 } else {
3592 &None
3593 }
3594 },
3595 pick_mut: |settings_content| {
3596 &mut settings_content
3597 .diagnostics
3598 .get_or_insert_default()
3599 .inline
3600 .get_or_insert_default()
3601 .update_debounce_ms
3602 },
3603 }),
3604 metadata: None,
3605 files: USER,
3606 }),
3607 SettingsPageItem::SettingItem(SettingItem {
3608 title: "Inline Padding",
3609 description: "The amount of padding between the end of the source line and the start of the inline diagnostic",
3610 field: Box::new(SettingField {
3611 pick: |settings_content| {
3612 if let Some(diagnostics) = &settings_content.diagnostics {
3613 if let Some(inline) = &diagnostics.inline {
3614 &inline.padding
3615 } else {
3616 &None
3617 }
3618 } else {
3619 &None
3620 }
3621 },
3622 pick_mut: |settings_content| {
3623 &mut settings_content
3624 .diagnostics
3625 .get_or_insert_default()
3626 .inline
3627 .get_or_insert_default()
3628 .padding
3629 },
3630 }),
3631 metadata: None,
3632 files: USER,
3633 }),
3634 SettingsPageItem::SettingItem(SettingItem {
3635 title: "Inline Min Column",
3636 description: "The minimum column to display inline diagnostics",
3637 field: Box::new(SettingField {
3638 pick: |settings_content| {
3639 if let Some(diagnostics) = &settings_content.diagnostics {
3640 if let Some(inline) = &diagnostics.inline {
3641 &inline.min_column
3642 } else {
3643 &None
3644 }
3645 } else {
3646 &None
3647 }
3648 },
3649 pick_mut: |settings_content| {
3650 &mut settings_content
3651 .diagnostics
3652 .get_or_insert_default()
3653 .inline
3654 .get_or_insert_default()
3655 .min_column
3656 },
3657 }),
3658 metadata: None,
3659 files: USER,
3660 }),
3661 SettingsPageItem::SectionHeader("Performance"),
3662 SettingsPageItem::SettingItem(SettingItem {
3663 title: "LSP Pull Diagnostics Enabled",
3664 description: "Whether to pull for language server-powered diagnostics or not",
3665 field: Box::new(SettingField {
3666 pick: |settings_content| {
3667 if let Some(diagnostics) = &settings_content.diagnostics {
3668 if let Some(lsp_pull) = &diagnostics.lsp_pull_diagnostics {
3669 &lsp_pull.enabled
3670 } else {
3671 &None
3672 }
3673 } else {
3674 &None
3675 }
3676 },
3677 pick_mut: |settings_content| {
3678 &mut settings_content
3679 .diagnostics
3680 .get_or_insert_default()
3681 .lsp_pull_diagnostics
3682 .get_or_insert_default()
3683 .enabled
3684 },
3685 }),
3686 metadata: None,
3687 files: USER,
3688 }),
3689 // todo(settings_ui): Needs unit
3690 SettingsPageItem::SettingItem(SettingItem {
3691 title: "LSP Pull Debounce",
3692 description: "Minimum time to wait before pulling diagnostics from the language server(s)",
3693 field: Box::new(SettingField {
3694 pick: |settings_content| {
3695 if let Some(diagnostics) = &settings_content.diagnostics {
3696 if let Some(lsp_pull) = &diagnostics.lsp_pull_diagnostics {
3697 &lsp_pull.debounce_ms
3698 } else {
3699 &None
3700 }
3701 } else {
3702 &None
3703 }
3704 },
3705 pick_mut: |settings_content| {
3706 &mut settings_content
3707 .diagnostics
3708 .get_or_insert_default()
3709 .lsp_pull_diagnostics
3710 .get_or_insert_default()
3711 .debounce_ms
3712 },
3713 }),
3714 metadata: None,
3715 files: USER,
3716 }),
3717 ],
3718 },
3719 SettingsPage {
3720 title: "Debugger",
3721 items: vec![
3722 SettingsPageItem::SectionHeader("General"),
3723 SettingsPageItem::SettingItem(SettingItem {
3724 title: "Stepping Granularity",
3725 description: "Determines the stepping granularity for debug operations",
3726 field: Box::new(SettingField {
3727 pick: |settings_content| {
3728 if let Some(debugger) = &settings_content.debugger {
3729 &debugger.stepping_granularity
3730 } else {
3731 &None
3732 }
3733 },
3734 pick_mut: |settings_content| {
3735 &mut settings_content
3736 .debugger
3737 .get_or_insert_default()
3738 .stepping_granularity
3739 },
3740 }),
3741 metadata: None,
3742 files: USER,
3743 }),
3744 SettingsPageItem::SettingItem(SettingItem {
3745 title: "Save Breakpoints",
3746 description: "Whether breakpoints should be reused across Zed sessions",
3747 field: Box::new(SettingField {
3748 pick: |settings_content| {
3749 if let Some(debugger) = &settings_content.debugger {
3750 &debugger.save_breakpoints
3751 } else {
3752 &None
3753 }
3754 },
3755 pick_mut: |settings_content| {
3756 &mut settings_content
3757 .debugger
3758 .get_or_insert_default()
3759 .save_breakpoints
3760 },
3761 }),
3762 metadata: None,
3763 files: USER,
3764 }),
3765 SettingsPageItem::SettingItem(SettingItem {
3766 title: "Timeout",
3767 description: "Time in milliseconds until timeout error when connecting to a TCP debug adapter",
3768 field: Box::new(SettingField {
3769 pick: |settings_content| {
3770 if let Some(debugger) = &settings_content.debugger {
3771 &debugger.timeout
3772 } else {
3773 &None
3774 }
3775 },
3776 pick_mut: |settings_content| {
3777 &mut settings_content.debugger.get_or_insert_default().timeout
3778 },
3779 }),
3780 metadata: None,
3781 files: USER,
3782 }),
3783 SettingsPageItem::SettingItem(SettingItem {
3784 title: "Dock",
3785 description: "The dock position of the debug panel",
3786 field: Box::new(SettingField {
3787 pick: |settings_content| {
3788 if let Some(debugger) = &settings_content.debugger {
3789 &debugger.dock
3790 } else {
3791 &None
3792 }
3793 },
3794 pick_mut: |settings_content| {
3795 &mut settings_content.debugger.get_or_insert_default().dock
3796 },
3797 }),
3798 metadata: None,
3799 files: USER,
3800 }),
3801 SettingsPageItem::SettingItem(SettingItem {
3802 title: "Log DAP Communications",
3803 description: "Whether to log messages between active debug adapters and Zed",
3804 field: Box::new(SettingField {
3805 pick: |settings_content| {
3806 if let Some(debugger) = &settings_content.debugger {
3807 &debugger.log_dap_communications
3808 } else {
3809 &None
3810 }
3811 },
3812 pick_mut: |settings_content| {
3813 &mut settings_content
3814 .debugger
3815 .get_or_insert_default()
3816 .log_dap_communications
3817 },
3818 }),
3819 metadata: None,
3820 files: USER,
3821 }),
3822 SettingsPageItem::SettingItem(SettingItem {
3823 title: "Format DAP Log Messages",
3824 description: "Whether to format DAP messages when adding them to debug adapter logger",
3825 field: Box::new(SettingField {
3826 pick: |settings_content| {
3827 if let Some(debugger) = &settings_content.debugger {
3828 &debugger.format_dap_log_messages
3829 } else {
3830 &None
3831 }
3832 },
3833 pick_mut: |settings_content| {
3834 &mut settings_content
3835 .debugger
3836 .get_or_insert_default()
3837 .format_dap_log_messages
3838 },
3839 }),
3840 metadata: None,
3841 files: USER,
3842 }),
3843 SettingsPageItem::SettingItem(SettingItem {
3844 title: "Button",
3845 description: "Whether to show the debug button in the status bar",
3846 field: Box::new(SettingField {
3847 pick: |settings_content| {
3848 if let Some(debugger) = &settings_content.debugger {
3849 &debugger.button
3850 } else {
3851 &None
3852 }
3853 },
3854 pick_mut: |settings_content| {
3855 &mut settings_content.debugger.get_or_insert_default().button
3856 },
3857 }),
3858 metadata: None,
3859 files: USER,
3860 }),
3861 ],
3862 },
3863 SettingsPage {
3864 title: "Collaboration",
3865 items: vec![
3866 SettingsPageItem::SectionHeader("Calls"),
3867 SettingsPageItem::SettingItem(SettingItem {
3868 title: "Mute On Join",
3869 description: "Whether the microphone should be muted when joining a channel or a call",
3870 field: Box::new(SettingField {
3871 pick: |settings_content| {
3872 if let Some(calls) = &settings_content.calls {
3873 &calls.mute_on_join
3874 } else {
3875 &None
3876 }
3877 },
3878 pick_mut: |settings_content| {
3879 &mut settings_content.calls.get_or_insert_default().mute_on_join
3880 },
3881 }),
3882 metadata: None,
3883 files: USER,
3884 }),
3885 SettingsPageItem::SettingItem(SettingItem {
3886 title: "Share On Join",
3887 description: "Whether your current project should be shared when joining an empty channel",
3888 field: Box::new(SettingField {
3889 pick: |settings_content| {
3890 if let Some(calls) = &settings_content.calls {
3891 &calls.share_on_join
3892 } else {
3893 &None
3894 }
3895 },
3896 pick_mut: |settings_content| {
3897 &mut settings_content.calls.get_or_insert_default().share_on_join
3898 },
3899 }),
3900 metadata: None,
3901 files: USER,
3902 }),
3903 SettingsPageItem::SectionHeader("Experimental"),
3904 SettingsPageItem::SettingItem(SettingItem {
3905 title: "Rodio Audio",
3906 description: "Opt into the new audio system",
3907 field: Box::new(SettingField {
3908 pick: |settings_content| {
3909 if let Some(audio) = &settings_content.audio {
3910 &audio.rodio_audio
3911 } else {
3912 &None
3913 }
3914 },
3915 pick_mut: |settings_content| {
3916 &mut settings_content.audio.get_or_insert_default().rodio_audio
3917 },
3918 }),
3919 metadata: None,
3920 files: USER,
3921 }),
3922 SettingsPageItem::SettingItem(SettingItem {
3923 title: "Auto Microphone Volume",
3924 description: "Automatically adjust microphone volume (requires Rodio Audio)",
3925 field: Box::new(SettingField {
3926 pick: |settings_content| {
3927 if let Some(audio) = &settings_content.audio {
3928 &audio.auto_microphone_volume
3929 } else {
3930 &None
3931 }
3932 },
3933 pick_mut: |settings_content| {
3934 &mut settings_content
3935 .audio
3936 .get_or_insert_default()
3937 .auto_microphone_volume
3938 },
3939 }),
3940 metadata: None,
3941 files: USER,
3942 }),
3943 SettingsPageItem::SettingItem(SettingItem {
3944 title: "Auto Speaker Volume",
3945 description: "Automatically adjust volume of other call members (requires Rodio Audio)",
3946 field: Box::new(SettingField {
3947 pick: |settings_content| {
3948 if let Some(audio) = &settings_content.audio {
3949 &audio.auto_speaker_volume
3950 } else {
3951 &None
3952 }
3953 },
3954 pick_mut: |settings_content| {
3955 &mut settings_content
3956 .audio
3957 .get_or_insert_default()
3958 .auto_speaker_volume
3959 },
3960 }),
3961 metadata: None,
3962 files: USER,
3963 }),
3964 SettingsPageItem::SettingItem(SettingItem {
3965 title: "Denoise",
3966 description: "Remove background noises (requires Rodio Audio)",
3967 field: Box::new(SettingField {
3968 pick: |settings_content| {
3969 if let Some(audio) = &settings_content.audio {
3970 &audio.denoise
3971 } else {
3972 &None
3973 }
3974 },
3975 pick_mut: |settings_content| {
3976 &mut settings_content.audio.get_or_insert_default().denoise
3977 },
3978 }),
3979 metadata: None,
3980 files: USER,
3981 }),
3982 SettingsPageItem::SettingItem(SettingItem {
3983 title: "Legacy Audio Compatible",
3984 description: "Use audio parameters compatible with previous versions (requires Rodio Audio)",
3985 field: Box::new(SettingField {
3986 pick: |settings_content| {
3987 if let Some(audio) = &settings_content.audio {
3988 &audio.legacy_audio_compatible
3989 } else {
3990 &None
3991 }
3992 },
3993 pick_mut: |settings_content| {
3994 &mut settings_content
3995 .audio
3996 .get_or_insert_default()
3997 .legacy_audio_compatible
3998 },
3999 }),
4000 metadata: None,
4001 files: USER,
4002 }),
4003 ],
4004 },
4005 SettingsPage {
4006 title: "AI",
4007 items: vec![
4008 SettingsPageItem::SectionHeader("General"),
4009 SettingsPageItem::SettingItem(SettingItem {
4010 title: "Disable AI",
4011 description: "Whether to disable all AI features in Zed",
4012 field: Box::new(SettingField {
4013 pick: |settings_content| &settings_content.disable_ai,
4014 pick_mut: |settings_content| &mut settings_content.disable_ai,
4015 }),
4016 metadata: None,
4017 files: USER,
4018 }),
4019 ],
4020 },
4021 ]
4022}
4023
4024const LANGUAGES_SECTION_HEADER: &'static str = "Languages";
4025
4026fn language_settings_data() -> Vec<SettingsPageItem> {
4027 fn current_language() -> Option<SharedString> {
4028 sub_page_stack().iter().find_map(|page| {
4029 (page.section_header == LANGUAGES_SECTION_HEADER)
4030 .then(|| SharedString::new_static(page.link.title))
4031 })
4032 }
4033
4034 fn language_settings_field<T>(
4035 settings_content: &SettingsContent,
4036 get: fn(&LanguageSettingsContent) -> &Option<T>,
4037 ) -> &Option<T> {
4038 let all_languages = &settings_content.project.all_languages;
4039 if let Some(current_language_name) = current_language() {
4040 if let Some(current_language) = all_languages.languages.0.get(¤t_language_name) {
4041 let value = get(current_language);
4042 if value.is_some() {
4043 return value;
4044 }
4045 }
4046 }
4047 let default_value = get(&all_languages.defaults);
4048 return default_value;
4049 }
4050
4051 fn language_settings_field_mut<T>(
4052 settings_content: &mut SettingsContent,
4053 get: fn(&mut LanguageSettingsContent) -> &mut Option<T>,
4054 ) -> &mut Option<T> {
4055 let all_languages = &mut settings_content.project.all_languages;
4056 let language_content = if let Some(current_language) = current_language() {
4057 all_languages
4058 .languages
4059 .0
4060 .entry(current_language)
4061 .or_default()
4062 } else {
4063 &mut all_languages.defaults
4064 };
4065 return get(language_content);
4066 }
4067
4068 vec![
4069 SettingsPageItem::SectionHeader("Indentation"),
4070 SettingsPageItem::SettingItem(SettingItem {
4071 title: "Tab Size",
4072 description: "How many columns a tab should occupy",
4073 field: Box::new(SettingField {
4074 pick: |settings_content| {
4075 language_settings_field(settings_content, |language| &language.tab_size)
4076 },
4077 pick_mut: |settings_content| {
4078 language_settings_field_mut(settings_content, |language| &mut language.tab_size)
4079 },
4080 }),
4081 metadata: None,
4082 files: USER | LOCAL,
4083 }),
4084 SettingsPageItem::SettingItem(SettingItem {
4085 title: "Hard Tabs",
4086 description: "Whether to indent lines using tab characters, as opposed to multiple spaces",
4087 field: Box::new(SettingField {
4088 pick: |settings_content| {
4089 language_settings_field(settings_content, |language| &language.hard_tabs)
4090 },
4091 pick_mut: |settings_content| {
4092 language_settings_field_mut(settings_content, |language| {
4093 &mut language.hard_tabs
4094 })
4095 },
4096 }),
4097 metadata: None,
4098 files: USER | LOCAL,
4099 }),
4100 SettingsPageItem::SettingItem(SettingItem {
4101 title: "Auto Indent",
4102 description: "Whether indentation should be adjusted based on the context whilst typing",
4103 field: Box::new(SettingField {
4104 pick: |settings_content| {
4105 language_settings_field(settings_content, |language| &language.auto_indent)
4106 },
4107 pick_mut: |settings_content| {
4108 language_settings_field_mut(settings_content, |language| {
4109 &mut language.auto_indent
4110 })
4111 },
4112 }),
4113 metadata: None,
4114 files: USER | LOCAL,
4115 }),
4116 SettingsPageItem::SettingItem(SettingItem {
4117 title: "Auto Indent On Paste",
4118 description: "Whether indentation of pasted content should be adjusted based on the context",
4119 field: Box::new(SettingField {
4120 pick: |settings_content| {
4121 language_settings_field(settings_content, |language| {
4122 &language.auto_indent_on_paste
4123 })
4124 },
4125 pick_mut: |settings_content| {
4126 language_settings_field_mut(settings_content, |language| {
4127 &mut language.auto_indent_on_paste
4128 })
4129 },
4130 }),
4131 metadata: None,
4132 files: USER | LOCAL,
4133 }),
4134 SettingsPageItem::SectionHeader("Wrapping"),
4135 SettingsPageItem::SettingItem(SettingItem {
4136 title: "Soft Wrap",
4137 description: "How to soft-wrap long lines of text",
4138 field: Box::new(SettingField {
4139 pick: |settings_content| {
4140 language_settings_field(settings_content, |language| &language.soft_wrap)
4141 },
4142 pick_mut: |settings_content| {
4143 language_settings_field_mut(settings_content, |language| {
4144 &mut language.soft_wrap
4145 })
4146 },
4147 }),
4148 metadata: None,
4149 files: USER | LOCAL,
4150 }),
4151 SettingsPageItem::SettingItem(SettingItem {
4152 title: "Show Wrap Guides",
4153 description: "Whether to show wrap guides in the editor. Setting this to true will show a guide at the 'preferred_line_length' value if softwrap is set to 'preferred_line_length', and will show any additional guides as specified by the 'wrap_guides' setting",
4154 field: Box::new(SettingField {
4155 pick: |settings_content| {
4156 language_settings_field(settings_content, |language| &language.show_wrap_guides)
4157 },
4158 pick_mut: |settings_content| {
4159 language_settings_field_mut(settings_content, |language| {
4160 &mut language.show_wrap_guides
4161 })
4162 },
4163 }),
4164 metadata: None,
4165 files: USER | LOCAL,
4166 }),
4167 SettingsPageItem::SettingItem(SettingItem {
4168 title: "Preferred Line Length",
4169 description: "The column at which to soft-wrap lines, for buffers where soft-wrap is enabled",
4170 field: Box::new(SettingField {
4171 pick: |settings_content| {
4172 language_settings_field(settings_content, |language| {
4173 &language.preferred_line_length
4174 })
4175 },
4176 pick_mut: |settings_content| {
4177 language_settings_field_mut(settings_content, |language| {
4178 &mut language.preferred_line_length
4179 })
4180 },
4181 }),
4182 metadata: None,
4183 files: USER | LOCAL,
4184 }),
4185 SettingsPageItem::SettingItem(SettingItem {
4186 title: "Wrap Guides",
4187 description: "Character counts at which to show wrap guides in the editor",
4188 field: Box::new(
4189 SettingField {
4190 pick: |settings_content| {
4191 language_settings_field(settings_content, |language| &language.wrap_guides)
4192 },
4193 pick_mut: |settings_content| {
4194 language_settings_field_mut(settings_content, |language| {
4195 &mut language.wrap_guides
4196 })
4197 },
4198 }
4199 .unimplemented(),
4200 ),
4201 metadata: None,
4202 files: USER | LOCAL,
4203 }),
4204 SettingsPageItem::SettingItem(SettingItem {
4205 title: "Allow Rewrap",
4206 description: "Controls where the `editor::Rewrap` action is allowed for this language",
4207 field: Box::new(SettingField {
4208 pick: |settings_content| {
4209 language_settings_field(settings_content, |language| &language.allow_rewrap)
4210 },
4211 pick_mut: |settings_content| {
4212 language_settings_field_mut(settings_content, |language| {
4213 &mut language.allow_rewrap
4214 })
4215 },
4216 }),
4217 metadata: None,
4218 files: USER | LOCAL,
4219 }),
4220 SettingsPageItem::SectionHeader("Indent Guides"),
4221 SettingsPageItem::SettingItem(SettingItem {
4222 title: "Enabled",
4223 description: "Whether to display indent guides in the editor",
4224 field: Box::new(SettingField {
4225 pick: |settings_content| {
4226 language_settings_field(settings_content, |language| {
4227 if let Some(indent_guides) = &language.indent_guides {
4228 &indent_guides.enabled
4229 } else {
4230 &None
4231 }
4232 })
4233 },
4234 pick_mut: |settings_content| {
4235 language_settings_field_mut(settings_content, |language| {
4236 &mut language.indent_guides.get_or_insert_default().enabled
4237 })
4238 },
4239 }),
4240 metadata: None,
4241 files: USER | LOCAL,
4242 }),
4243 SettingsPageItem::SettingItem(SettingItem {
4244 title: "Line Width",
4245 description: "The width of the indent guides in pixels, between 1 and 10",
4246 field: Box::new(SettingField {
4247 pick: |settings_content| {
4248 language_settings_field(settings_content, |language| {
4249 if let Some(indent_guides) = &language.indent_guides {
4250 &indent_guides.line_width
4251 } else {
4252 &None
4253 }
4254 })
4255 },
4256 pick_mut: |settings_content| {
4257 language_settings_field_mut(settings_content, |language| {
4258 &mut language.indent_guides.get_or_insert_default().line_width
4259 })
4260 },
4261 }),
4262 metadata: None,
4263 files: USER | LOCAL,
4264 }),
4265 SettingsPageItem::SettingItem(SettingItem {
4266 title: "Active Line Width",
4267 description: "The width of the active indent guide in pixels, between 1 and 10",
4268 field: Box::new(SettingField {
4269 pick: |settings_content| {
4270 language_settings_field(settings_content, |language| {
4271 if let Some(indent_guides) = &language.indent_guides {
4272 &indent_guides.active_line_width
4273 } else {
4274 &None
4275 }
4276 })
4277 },
4278 pick_mut: |settings_content| {
4279 language_settings_field_mut(settings_content, |language| {
4280 &mut language
4281 .indent_guides
4282 .get_or_insert_default()
4283 .active_line_width
4284 })
4285 },
4286 }),
4287 metadata: None,
4288 files: USER | LOCAL,
4289 }),
4290 SettingsPageItem::SettingItem(SettingItem {
4291 title: "Coloring",
4292 description: "Determines how indent guides are colored",
4293 field: Box::new(SettingField {
4294 pick: |settings_content| {
4295 language_settings_field(settings_content, |language| {
4296 if let Some(indent_guides) = &language.indent_guides {
4297 &indent_guides.coloring
4298 } else {
4299 &None
4300 }
4301 })
4302 },
4303 pick_mut: |settings_content| {
4304 language_settings_field_mut(settings_content, |language| {
4305 &mut language.indent_guides.get_or_insert_default().coloring
4306 })
4307 },
4308 }),
4309 metadata: None,
4310 files: USER | LOCAL,
4311 }),
4312 SettingsPageItem::SettingItem(SettingItem {
4313 title: "Background Coloring",
4314 description: "Determines how indent guide backgrounds are colored",
4315 field: Box::new(SettingField {
4316 pick: |settings_content| {
4317 language_settings_field(settings_content, |language| {
4318 if let Some(indent_guides) = &language.indent_guides {
4319 &indent_guides.background_coloring
4320 } else {
4321 &None
4322 }
4323 })
4324 },
4325 pick_mut: |settings_content| {
4326 language_settings_field_mut(settings_content, |language| {
4327 &mut language
4328 .indent_guides
4329 .get_or_insert_default()
4330 .background_coloring
4331 })
4332 },
4333 }),
4334 metadata: None,
4335 files: USER | LOCAL,
4336 }),
4337 SettingsPageItem::SectionHeader("Formatting"),
4338 SettingsPageItem::SettingItem(SettingItem {
4339 title: "Format On Save",
4340 description: "Whether or not to perform a buffer format before saving",
4341 field: Box::new(
4342 // TODO(settings_ui): this setting should just be a bool
4343 SettingField {
4344 pick: |settings_content| {
4345 language_settings_field(settings_content, |language| {
4346 &language.format_on_save
4347 })
4348 },
4349 pick_mut: |settings_content| {
4350 language_settings_field_mut(settings_content, |language| {
4351 &mut language.format_on_save
4352 })
4353 },
4354 },
4355 ),
4356 metadata: None,
4357 files: USER | LOCAL,
4358 }),
4359 SettingsPageItem::SettingItem(SettingItem {
4360 title: "Remove Trailing Whitespace On Save",
4361 description: "Whether or not to remove any trailing whitespace from lines of a buffer before saving it",
4362 field: Box::new(SettingField {
4363 pick: |settings_content| {
4364 language_settings_field(settings_content, |language| {
4365 &language.remove_trailing_whitespace_on_save
4366 })
4367 },
4368 pick_mut: |settings_content| {
4369 language_settings_field_mut(settings_content, |language| {
4370 &mut language.remove_trailing_whitespace_on_save
4371 })
4372 },
4373 }),
4374 metadata: None,
4375 files: USER | LOCAL,
4376 }),
4377 SettingsPageItem::SettingItem(SettingItem {
4378 title: "Ensure Final Newline On Save",
4379 description: "Whether or not to ensure there's a single newline at the end of a buffer when saving it",
4380 field: Box::new(SettingField {
4381 pick: |settings_content| {
4382 language_settings_field(settings_content, |language| {
4383 &language.ensure_final_newline_on_save
4384 })
4385 },
4386 pick_mut: |settings_content| {
4387 language_settings_field_mut(settings_content, |language| {
4388 &mut language.ensure_final_newline_on_save
4389 })
4390 },
4391 }),
4392 metadata: None,
4393 files: USER | LOCAL,
4394 }),
4395 SettingsPageItem::SettingItem(SettingItem {
4396 title: "Formatter",
4397 description: "How to perform a buffer format",
4398 field: Box::new(
4399 SettingField {
4400 pick: |settings_content| {
4401 language_settings_field(settings_content, |language| &language.formatter)
4402 },
4403 pick_mut: |settings_content| {
4404 language_settings_field_mut(settings_content, |language| {
4405 &mut language.formatter
4406 })
4407 },
4408 }
4409 .unimplemented(),
4410 ),
4411 metadata: None,
4412 files: USER | LOCAL,
4413 }),
4414 SettingsPageItem::SettingItem(SettingItem {
4415 title: "Use On Type Format",
4416 description: "Whether to use additional LSP queries to format (and amend) the code after every \"trigger\" symbol input, defined by LSP server capabilities",
4417 field: Box::new(SettingField {
4418 pick: |settings_content| {
4419 language_settings_field(settings_content, |language| {
4420 &language.use_on_type_format
4421 })
4422 },
4423 pick_mut: |settings_content| {
4424 language_settings_field_mut(settings_content, |language| {
4425 &mut language.use_on_type_format
4426 })
4427 },
4428 }),
4429 metadata: None,
4430 files: USER | LOCAL,
4431 }),
4432 SettingsPageItem::SettingItem(SettingItem {
4433 title: "Code Actions On Format",
4434 description: "Which code actions to run on save after the formatter. These are not run if formatting is off",
4435 field: Box::new(
4436 SettingField {
4437 pick: |settings_content| {
4438 language_settings_field(settings_content, |language| {
4439 &language.code_actions_on_format
4440 })
4441 },
4442 pick_mut: |settings_content| {
4443 language_settings_field_mut(settings_content, |language| {
4444 &mut language.code_actions_on_format
4445 })
4446 },
4447 }
4448 .unimplemented(),
4449 ),
4450 metadata: None,
4451 files: USER | LOCAL,
4452 }),
4453 SettingsPageItem::SectionHeader("Prettier"),
4454 SettingsPageItem::SettingItem(SettingItem {
4455 title: "Allowed",
4456 description: "Enables or disables formatting with Prettier for a given language",
4457 field: Box::new(SettingField {
4458 pick: |settings_content| {
4459 language_settings_field(settings_content, |language| {
4460 if let Some(prettier) = &language.prettier {
4461 &prettier.allowed
4462 } else {
4463 &None
4464 }
4465 })
4466 },
4467 pick_mut: |settings_content| {
4468 language_settings_field_mut(settings_content, |language| {
4469 &mut language.prettier.get_or_insert_default().allowed
4470 })
4471 },
4472 }),
4473 metadata: None,
4474 files: USER | LOCAL,
4475 }),
4476 SettingsPageItem::SettingItem(SettingItem {
4477 title: "Parser",
4478 description: "Forces Prettier integration to use a specific parser name when formatting files with the language",
4479 field: Box::new(SettingField {
4480 pick: |settings_content| {
4481 language_settings_field(settings_content, |language| {
4482 if let Some(prettier) = &language.prettier {
4483 &prettier.parser
4484 } else {
4485 &None
4486 }
4487 })
4488 },
4489 pick_mut: |settings_content| {
4490 language_settings_field_mut(settings_content, |language| {
4491 &mut language.prettier.get_or_insert_default().parser
4492 })
4493 },
4494 }),
4495 metadata: None,
4496 files: USER | LOCAL,
4497 }),
4498 SettingsPageItem::SettingItem(SettingItem {
4499 title: "Plugins",
4500 description: "Forces Prettier integration to use specific plugins when formatting files with the language",
4501 field: Box::new(
4502 SettingField {
4503 pick: |settings_content| {
4504 language_settings_field(settings_content, |language| {
4505 if let Some(prettier) = &language.prettier {
4506 &prettier.plugins
4507 } else {
4508 &None
4509 }
4510 })
4511 },
4512 pick_mut: |settings_content| {
4513 language_settings_field_mut(settings_content, |language| {
4514 &mut language.prettier.get_or_insert_default().plugins
4515 })
4516 },
4517 }
4518 .unimplemented(),
4519 ),
4520 metadata: None,
4521 files: USER | LOCAL,
4522 }),
4523 SettingsPageItem::SettingItem(SettingItem {
4524 title: "Options",
4525 description: "Default Prettier options, in the format as in package.json section for Prettier",
4526 field: Box::new(
4527 SettingField {
4528 pick: |settings_content| {
4529 language_settings_field(settings_content, |language| {
4530 if let Some(prettier) = &language.prettier {
4531 &prettier.options
4532 } else {
4533 &None
4534 }
4535 })
4536 },
4537 pick_mut: |settings_content| {
4538 language_settings_field_mut(settings_content, |language| {
4539 &mut language.prettier.get_or_insert_default().options
4540 })
4541 },
4542 }
4543 .unimplemented(),
4544 ),
4545 metadata: None,
4546 files: USER | LOCAL,
4547 }),
4548 SettingsPageItem::SectionHeader("Autoclose"),
4549 SettingsPageItem::SettingItem(SettingItem {
4550 title: "Use Autoclose",
4551 description: "Whether to automatically type closing characters for you. For example, when you type (, Zed will automatically add a closing ) at the correct position",
4552 field: Box::new(SettingField {
4553 pick: |settings_content| {
4554 language_settings_field(settings_content, |language| &language.use_autoclose)
4555 },
4556 pick_mut: |settings_content| {
4557 language_settings_field_mut(settings_content, |language| {
4558 &mut language.use_autoclose
4559 })
4560 },
4561 }),
4562 metadata: None,
4563 files: USER | LOCAL,
4564 }),
4565 SettingsPageItem::SettingItem(SettingItem {
4566 title: "Use Auto Surround",
4567 description: "Whether to automatically surround text with characters for you. For example, when you select text and type (, Zed will automatically surround text with ()",
4568 field: Box::new(SettingField {
4569 pick: |settings_content| {
4570 language_settings_field(settings_content, |language| {
4571 &language.use_auto_surround
4572 })
4573 },
4574 pick_mut: |settings_content| {
4575 language_settings_field_mut(settings_content, |language| {
4576 &mut language.use_auto_surround
4577 })
4578 },
4579 }),
4580 metadata: None,
4581 files: USER | LOCAL,
4582 }),
4583 SettingsPageItem::SettingItem(SettingItem {
4584 title: "Always Treat Brackets As Autoclosed",
4585 description: "Controls how the editor handles the autoclosed characters. When set to `false`(default), skipping over and auto-removing of the closing characters happen only for auto-inserted characters. Otherwise(when `true`), the closing characters are always skipped over and auto-removed no matter how they were inserted",
4586 field: Box::new(SettingField {
4587 pick: |settings_content| {
4588 language_settings_field(settings_content, |language| {
4589 &language.always_treat_brackets_as_autoclosed
4590 })
4591 },
4592 pick_mut: |settings_content| {
4593 language_settings_field_mut(settings_content, |language| {
4594 &mut language.always_treat_brackets_as_autoclosed
4595 })
4596 },
4597 }),
4598 metadata: None,
4599 files: USER | LOCAL,
4600 }),
4601 SettingsPageItem::SettingItem(SettingItem {
4602 title: "Jsx Tag Auto Close",
4603 description: "Whether to automatically close JSX tags",
4604 field: Box::new(SettingField {
4605 // TODO(settings_ui): this setting should just be a bool
4606 pick: |settings_content| {
4607 language_settings_field(settings_content, |language| {
4608 match language.jsx_tag_auto_close.as_ref() {
4609 Some(s) => &s.enabled,
4610 None => &None,
4611 }
4612 })
4613 },
4614 pick_mut: |settings_content| {
4615 language_settings_field_mut(settings_content, |language| {
4616 &mut language.jsx_tag_auto_close.get_or_insert_default().enabled
4617 })
4618 },
4619 }),
4620 metadata: None,
4621 files: USER | LOCAL,
4622 }),
4623 SettingsPageItem::SectionHeader("LSP"),
4624 SettingsPageItem::SettingItem(SettingItem {
4625 title: "Enable Language Server",
4626 description: "Whether to use language servers to provide code intelligence",
4627 field: Box::new(SettingField {
4628 pick: |settings_content| {
4629 language_settings_field(settings_content, |language| {
4630 &language.enable_language_server
4631 })
4632 },
4633 pick_mut: |settings_content| {
4634 language_settings_field_mut(settings_content, |language| {
4635 &mut language.enable_language_server
4636 })
4637 },
4638 }),
4639 metadata: None,
4640 files: USER | LOCAL,
4641 }),
4642 SettingsPageItem::SettingItem(SettingItem {
4643 title: "Language Servers",
4644 description: "The list of language servers to use (or disable) for this language",
4645 field: Box::new(
4646 SettingField {
4647 pick: |settings_content| {
4648 language_settings_field(settings_content, |language| {
4649 &language.language_servers
4650 })
4651 },
4652 pick_mut: |settings_content| {
4653 language_settings_field_mut(settings_content, |language| {
4654 &mut language.language_servers
4655 })
4656 },
4657 }
4658 .unimplemented(),
4659 ),
4660 metadata: None,
4661 files: USER | LOCAL,
4662 }),
4663 SettingsPageItem::SettingItem(SettingItem {
4664 title: "Linked Edits",
4665 description: "Whether to perform linked edits of associated ranges, if the language server supports it. For example, when editing opening <html> tag, the contents of the closing </html> tag will be edited as well",
4666 field: Box::new(SettingField {
4667 pick: |settings_content| {
4668 language_settings_field(settings_content, |language| &language.linked_edits)
4669 },
4670 pick_mut: |settings_content| {
4671 language_settings_field_mut(settings_content, |language| {
4672 &mut language.linked_edits
4673 })
4674 },
4675 }),
4676 metadata: None,
4677 files: USER | LOCAL,
4678 }),
4679 SettingsPageItem::SectionHeader("Edit Predictions"),
4680 SettingsPageItem::SettingItem(SettingItem {
4681 title: "Show Edit Predictions",
4682 description: "Controls whether edit predictions are shown immediately (true) or manually by triggering `editor::ShowEditPrediction` (false)",
4683 field: Box::new(SettingField {
4684 pick: |settings_content| {
4685 language_settings_field(settings_content, |language| {
4686 &language.show_edit_predictions
4687 })
4688 },
4689 pick_mut: |settings_content| {
4690 language_settings_field_mut(settings_content, |language| {
4691 &mut language.show_edit_predictions
4692 })
4693 },
4694 }),
4695 metadata: None,
4696 files: USER | LOCAL,
4697 }),
4698 SettingsPageItem::SettingItem(SettingItem {
4699 title: "Edit Predictions Disabled In",
4700 description: "Controls whether edit predictions are shown in the given language scopes",
4701 field: Box::new(
4702 SettingField {
4703 pick: |settings_content| {
4704 language_settings_field(settings_content, |language| {
4705 &language.edit_predictions_disabled_in
4706 })
4707 },
4708 pick_mut: |settings_content| {
4709 language_settings_field_mut(settings_content, |language| {
4710 &mut language.edit_predictions_disabled_in
4711 })
4712 },
4713 }
4714 .unimplemented(),
4715 ),
4716 metadata: None,
4717 files: USER | LOCAL,
4718 }),
4719 SettingsPageItem::SectionHeader("Whitespace"),
4720 SettingsPageItem::SettingItem(SettingItem {
4721 title: "Show Whitespaces",
4722 description: "Whether to show tabs and spaces in the editor",
4723 field: Box::new(SettingField {
4724 pick: |settings_content| {
4725 language_settings_field(settings_content, |language| &language.show_whitespaces)
4726 },
4727 pick_mut: |settings_content| {
4728 language_settings_field_mut(settings_content, |language| {
4729 &mut language.show_whitespaces
4730 })
4731 },
4732 }),
4733 metadata: None,
4734 files: USER | LOCAL,
4735 }),
4736 SettingsPageItem::SettingItem(SettingItem {
4737 title: "Space Whitespace Indicator",
4738 description: "Visible character used to render space characters when show_whitespaces is enabled (default: \"•\")",
4739 field: Box::new(
4740 SettingField {
4741 pick: |settings_content| {
4742 language_settings_field(settings_content, |language| {
4743 if let Some(whitespace_map) = &language.whitespace_map {
4744 &whitespace_map.space
4745 } else {
4746 &None
4747 }
4748 })
4749 },
4750 pick_mut: |settings_content| {
4751 language_settings_field_mut(settings_content, |language| {
4752 &mut language.whitespace_map.get_or_insert_default().space
4753 })
4754 },
4755 }
4756 .unimplemented(),
4757 ),
4758 metadata: None,
4759 files: USER | LOCAL,
4760 }),
4761 SettingsPageItem::SettingItem(SettingItem {
4762 title: "Tab Whitespace Indicator",
4763 description: "Visible character used to render tab characters when show_whitespaces is enabled (default: \"→\")",
4764 field: Box::new(
4765 SettingField {
4766 pick: |settings_content| {
4767 language_settings_field(settings_content, |language| {
4768 if let Some(whitespace_map) = &language.whitespace_map {
4769 &whitespace_map.tab
4770 } else {
4771 &None
4772 }
4773 })
4774 },
4775 pick_mut: |settings_content| {
4776 language_settings_field_mut(settings_content, |language| {
4777 &mut language.whitespace_map.get_or_insert_default().tab
4778 })
4779 },
4780 }
4781 .unimplemented(),
4782 ),
4783 metadata: None,
4784 files: USER | LOCAL,
4785 }),
4786 SettingsPageItem::SectionHeader("Completions"),
4787 SettingsPageItem::SettingItem(SettingItem {
4788 title: "Show Completions On Input",
4789 description: "Whether to pop the completions menu while typing in an editor without explicitly requesting it",
4790 field: Box::new(SettingField {
4791 pick: |settings_content| {
4792 language_settings_field(settings_content, |language| {
4793 &language.show_completions_on_input
4794 })
4795 },
4796 pick_mut: |settings_content| {
4797 language_settings_field_mut(settings_content, |language| {
4798 &mut language.show_completions_on_input
4799 })
4800 },
4801 }),
4802 metadata: None,
4803 files: USER | LOCAL,
4804 }),
4805 SettingsPageItem::SettingItem(SettingItem {
4806 title: "Show Completion Documentation",
4807 description: "Whether to display inline and alongside documentation for items in the completions menu",
4808 field: Box::new(SettingField {
4809 pick: |settings_content| {
4810 language_settings_field(settings_content, |language| {
4811 &language.show_completion_documentation
4812 })
4813 },
4814 pick_mut: |settings_content| {
4815 language_settings_field_mut(settings_content, |language| {
4816 &mut language.show_completion_documentation
4817 })
4818 },
4819 }),
4820 metadata: None,
4821 files: USER | LOCAL,
4822 }),
4823 SettingsPageItem::SettingItem(SettingItem {
4824 title: "Words",
4825 description: "Controls how words are completed",
4826 field: Box::new(SettingField {
4827 pick: |settings_content| {
4828 language_settings_field(settings_content, |language| {
4829 if let Some(completions) = &language.completions {
4830 &completions.words
4831 } else {
4832 &None
4833 }
4834 })
4835 },
4836 pick_mut: |settings_content| {
4837 language_settings_field_mut(settings_content, |language| {
4838 &mut language.completions.get_or_insert_default().words
4839 })
4840 },
4841 }),
4842 metadata: None,
4843 files: USER | LOCAL,
4844 }),
4845 SettingsPageItem::SettingItem(SettingItem {
4846 title: "Words Min Length",
4847 description: "How many characters has to be in the completions query to automatically show the words-based completions",
4848 field: Box::new(SettingField {
4849 pick: |settings_content| {
4850 language_settings_field(settings_content, |language| {
4851 if let Some(completions) = &language.completions {
4852 &completions.words_min_length
4853 } else {
4854 &None
4855 }
4856 })
4857 },
4858 pick_mut: |settings_content| {
4859 language_settings_field_mut(settings_content, |language| {
4860 &mut language
4861 .completions
4862 .get_or_insert_default()
4863 .words_min_length
4864 })
4865 },
4866 }),
4867 metadata: None,
4868 files: USER | LOCAL,
4869 }),
4870 SettingsPageItem::SettingItem(SettingItem {
4871 title: "Lsp",
4872 description: "Whether to fetch LSP completions or not",
4873 field: Box::new(SettingField {
4874 pick: |settings_content| {
4875 language_settings_field(settings_content, |language| {
4876 if let Some(completions) = &language.completions {
4877 &completions.lsp
4878 } else {
4879 &None
4880 }
4881 })
4882 },
4883 pick_mut: |settings_content| {
4884 language_settings_field_mut(settings_content, |language| {
4885 &mut language.completions.get_or_insert_default().lsp
4886 })
4887 },
4888 }),
4889 metadata: None,
4890 files: USER | LOCAL,
4891 }),
4892 SettingsPageItem::SettingItem(SettingItem {
4893 title: "Lsp Fetch Timeout Ms",
4894 description: "When fetching LSP completions, determines how long to wait for a response of a particular server (set to 0 to wait indefinitely)",
4895 field: Box::new(SettingField {
4896 pick: |settings_content| {
4897 language_settings_field(settings_content, |language| {
4898 if let Some(completions) = &language.completions {
4899 &completions.lsp_fetch_timeout_ms
4900 } else {
4901 &None
4902 }
4903 })
4904 },
4905 pick_mut: |settings_content| {
4906 language_settings_field_mut(settings_content, |language| {
4907 &mut language
4908 .completions
4909 .get_or_insert_default()
4910 .lsp_fetch_timeout_ms
4911 })
4912 },
4913 }),
4914 metadata: None,
4915 files: USER | LOCAL,
4916 }),
4917 SettingsPageItem::SettingItem(SettingItem {
4918 title: "Lsp Insert Mode",
4919 description: "Controls how LSP completions are inserted",
4920 field: Box::new(SettingField {
4921 pick: |settings_content| {
4922 language_settings_field(settings_content, |language| {
4923 if let Some(completions) = &language.completions {
4924 &completions.lsp_insert_mode
4925 } else {
4926 &None
4927 }
4928 })
4929 },
4930 pick_mut: |settings_content| {
4931 language_settings_field_mut(settings_content, |language| {
4932 &mut language.completions.get_or_insert_default().lsp_insert_mode
4933 })
4934 },
4935 }),
4936 metadata: None,
4937 files: USER | LOCAL,
4938 }),
4939 SettingsPageItem::SectionHeader("Inlay Hints"),
4940 SettingsPageItem::SettingItem(SettingItem {
4941 title: "Enabled",
4942 description: "Global switch to toggle hints on and off",
4943 field: Box::new(SettingField {
4944 pick: |settings_content| {
4945 language_settings_field(settings_content, |language| {
4946 if let Some(inlay_hints) = &language.inlay_hints {
4947 &inlay_hints.enabled
4948 } else {
4949 &None
4950 }
4951 })
4952 },
4953 pick_mut: |settings_content| {
4954 language_settings_field_mut(settings_content, |language| {
4955 &mut language.inlay_hints.get_or_insert_default().enabled
4956 })
4957 },
4958 }),
4959 metadata: None,
4960 files: USER | LOCAL,
4961 }),
4962 SettingsPageItem::SettingItem(SettingItem {
4963 title: "Show Value Hints",
4964 description: "Global switch to toggle inline values on and off when debugging",
4965 field: Box::new(SettingField {
4966 pick: |settings_content| {
4967 language_settings_field(settings_content, |language| {
4968 if let Some(inlay_hints) = &language.inlay_hints {
4969 &inlay_hints.show_value_hints
4970 } else {
4971 &None
4972 }
4973 })
4974 },
4975 pick_mut: |settings_content| {
4976 language_settings_field_mut(settings_content, |language| {
4977 &mut language
4978 .inlay_hints
4979 .get_or_insert_default()
4980 .show_value_hints
4981 })
4982 },
4983 }),
4984 metadata: None,
4985 files: USER | LOCAL,
4986 }),
4987 SettingsPageItem::SettingItem(SettingItem {
4988 title: "Show Type Hints",
4989 description: "Whether type hints should be shown",
4990 field: Box::new(SettingField {
4991 pick: |settings_content| {
4992 language_settings_field(settings_content, |language| {
4993 if let Some(inlay_hints) = &language.inlay_hints {
4994 &inlay_hints.show_type_hints
4995 } else {
4996 &None
4997 }
4998 })
4999 },
5000 pick_mut: |settings_content| {
5001 language_settings_field_mut(settings_content, |language| {
5002 &mut language.inlay_hints.get_or_insert_default().show_type_hints
5003 })
5004 },
5005 }),
5006 metadata: None,
5007 files: USER | LOCAL,
5008 }),
5009 SettingsPageItem::SettingItem(SettingItem {
5010 title: "Show Parameter Hints",
5011 description: "Whether parameter hints should be shown",
5012 field: Box::new(SettingField {
5013 pick: |settings_content| {
5014 language_settings_field(settings_content, |language| {
5015 if let Some(inlay_hints) = &language.inlay_hints {
5016 &inlay_hints.show_parameter_hints
5017 } else {
5018 &None
5019 }
5020 })
5021 },
5022 pick_mut: |settings_content| {
5023 language_settings_field_mut(settings_content, |language| {
5024 &mut language
5025 .inlay_hints
5026 .get_or_insert_default()
5027 .show_parameter_hints
5028 })
5029 },
5030 }),
5031 metadata: None,
5032 files: USER | LOCAL,
5033 }),
5034 SettingsPageItem::SettingItem(SettingItem {
5035 title: "Show Other Hints",
5036 description: "Whether other hints should be shown",
5037 field: Box::new(SettingField {
5038 pick: |settings_content| {
5039 language_settings_field(settings_content, |language| {
5040 if let Some(inlay_hints) = &language.inlay_hints {
5041 &inlay_hints.show_other_hints
5042 } else {
5043 &None
5044 }
5045 })
5046 },
5047 pick_mut: |settings_content| {
5048 language_settings_field_mut(settings_content, |language| {
5049 &mut language
5050 .inlay_hints
5051 .get_or_insert_default()
5052 .show_other_hints
5053 })
5054 },
5055 }),
5056 metadata: None,
5057 files: USER | LOCAL,
5058 }),
5059 SettingsPageItem::SettingItem(SettingItem {
5060 title: "Show Background",
5061 description: "Whether to show a background for inlay hints",
5062 field: Box::new(SettingField {
5063 pick: |settings_content| {
5064 language_settings_field(settings_content, |language| {
5065 if let Some(inlay_hints) = &language.inlay_hints {
5066 &inlay_hints.show_background
5067 } else {
5068 &None
5069 }
5070 })
5071 },
5072 pick_mut: |settings_content| {
5073 language_settings_field_mut(settings_content, |language| {
5074 &mut language.inlay_hints.get_or_insert_default().show_background
5075 })
5076 },
5077 }),
5078 metadata: None,
5079 files: USER | LOCAL,
5080 }),
5081 SettingsPageItem::SettingItem(SettingItem {
5082 title: "Edit Debounce Ms",
5083 description: "Whether or not to debounce inlay hints updates after buffer edits (set to 0 to disable debouncing)",
5084 field: Box::new(SettingField {
5085 pick: |settings_content| {
5086 language_settings_field(settings_content, |language| {
5087 if let Some(inlay_hints) = &language.inlay_hints {
5088 &inlay_hints.edit_debounce_ms
5089 } else {
5090 &None
5091 }
5092 })
5093 },
5094 pick_mut: |settings_content| {
5095 language_settings_field_mut(settings_content, |language| {
5096 &mut language
5097 .inlay_hints
5098 .get_or_insert_default()
5099 .edit_debounce_ms
5100 })
5101 },
5102 }),
5103 metadata: None,
5104 files: USER | LOCAL,
5105 }),
5106 SettingsPageItem::SettingItem(SettingItem {
5107 title: "Scroll Debounce Ms",
5108 description: "Whether or not to debounce inlay hints updates after buffer scrolls (set to 0 to disable debouncing)",
5109 field: Box::new(SettingField {
5110 pick: |settings_content| {
5111 language_settings_field(settings_content, |language| {
5112 if let Some(inlay_hints) = &language.inlay_hints {
5113 &inlay_hints.scroll_debounce_ms
5114 } else {
5115 &None
5116 }
5117 })
5118 },
5119 pick_mut: |settings_content| {
5120 language_settings_field_mut(settings_content, |language| {
5121 &mut language
5122 .inlay_hints
5123 .get_or_insert_default()
5124 .scroll_debounce_ms
5125 })
5126 },
5127 }),
5128 metadata: None,
5129 files: USER | LOCAL,
5130 }),
5131 SettingsPageItem::SettingItem(SettingItem {
5132 title: "Toggle On Modifiers Press",
5133 description: "Toggles inlay hints (hides or shows) when the user | LOCAL presses the modifiers specified",
5134 field: Box::new(
5135 SettingField {
5136 pick: |settings_content| {
5137 language_settings_field(settings_content, |language| {
5138 if let Some(inlay_hints) = &language.inlay_hints {
5139 &inlay_hints.toggle_on_modifiers_press
5140 } else {
5141 &None
5142 }
5143 })
5144 },
5145 pick_mut: |settings_content| {
5146 language_settings_field_mut(settings_content, |language| {
5147 &mut language
5148 .inlay_hints
5149 .get_or_insert_default()
5150 .toggle_on_modifiers_press
5151 })
5152 },
5153 }
5154 .unimplemented(),
5155 ),
5156 metadata: None,
5157 files: USER | LOCAL,
5158 }),
5159 SettingsPageItem::SectionHeader("Tasks"),
5160 SettingsPageItem::SettingItem(SettingItem {
5161 title: "Enabled",
5162 description: "Whether tasks are enabled for this language",
5163 field: Box::new(SettingField {
5164 pick: |settings_content| {
5165 language_settings_field(settings_content, |language| {
5166 if let Some(tasks) = &language.tasks {
5167 &tasks.enabled
5168 } else {
5169 &None
5170 }
5171 })
5172 },
5173 pick_mut: |settings_content| {
5174 language_settings_field_mut(settings_content, |language| {
5175 &mut language.tasks.get_or_insert_default().enabled
5176 })
5177 },
5178 }),
5179 metadata: None,
5180 files: USER | LOCAL,
5181 }),
5182 SettingsPageItem::SettingItem(SettingItem {
5183 title: "Variables",
5184 description: "Extra task variables to set for a particular language",
5185 field: Box::new(
5186 SettingField {
5187 pick: |settings_content| {
5188 language_settings_field(settings_content, |language| {
5189 if let Some(tasks) = &language.tasks {
5190 &tasks.variables
5191 } else {
5192 &None
5193 }
5194 })
5195 },
5196 pick_mut: |settings_content| {
5197 language_settings_field_mut(settings_content, |language| {
5198 &mut language.tasks.get_or_insert_default().variables
5199 })
5200 },
5201 }
5202 .unimplemented(),
5203 ),
5204 metadata: None,
5205 files: USER | LOCAL,
5206 }),
5207 SettingsPageItem::SettingItem(SettingItem {
5208 title: "Prefer Lsp",
5209 description: "Use LSP tasks over Zed language extension ones",
5210 field: Box::new(SettingField {
5211 pick: |settings_content| {
5212 language_settings_field(settings_content, |language| {
5213 if let Some(tasks) = &language.tasks {
5214 &tasks.prefer_lsp
5215 } else {
5216 &None
5217 }
5218 })
5219 },
5220 pick_mut: |settings_content| {
5221 language_settings_field_mut(settings_content, |language| {
5222 &mut language.tasks.get_or_insert_default().prefer_lsp
5223 })
5224 },
5225 }),
5226 metadata: None,
5227 files: USER | LOCAL,
5228 }),
5229 SettingsPageItem::SectionHeader("Miscellaneous"),
5230 SettingsPageItem::SettingItem(SettingItem {
5231 title: "Debuggers",
5232 description: "Preferred debuggers for this language",
5233 field: Box::new(
5234 SettingField {
5235 pick: |settings_content| {
5236 language_settings_field(settings_content, |language| &language.debuggers)
5237 },
5238 pick_mut: |settings_content| {
5239 language_settings_field_mut(settings_content, |language| {
5240 &mut language.debuggers
5241 })
5242 },
5243 }
5244 .unimplemented(),
5245 ),
5246 metadata: None,
5247 files: USER | LOCAL,
5248 }),
5249 SettingsPageItem::SettingItem(SettingItem {
5250 title: "Extend Comment On Newline",
5251 description: "Whether to start a new line with a comment when a previous line is a comment as well",
5252 field: Box::new(SettingField {
5253 pick: |settings_content| {
5254 language_settings_field(settings_content, |language| {
5255 &language.extend_comment_on_newline
5256 })
5257 },
5258 pick_mut: |settings_content| {
5259 language_settings_field_mut(settings_content, |language| {
5260 &mut language.extend_comment_on_newline
5261 })
5262 },
5263 }),
5264 metadata: None,
5265 files: USER | LOCAL,
5266 }),
5267 ]
5268}