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