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