1use std::{
2 path::{Path, PathBuf},
3 sync::Arc,
4};
5
6use anyhow::Context;
7use collections::{BTreeMap, HashMap};
8use gpui::Rgba;
9use schemars::JsonSchema;
10use serde::{Deserialize, Serialize};
11use settings_json::parse_json_with_comments;
12use settings_macros::{MergeFrom, with_fallible_options};
13use util::serde::default_true;
14
15use crate::{
16 AllLanguageSettingsContent, DelayMs, ExtendingVec, ParseStatus, ProjectTerminalSettingsContent,
17 RootUserSettings, SaturatingBool, fallible_options,
18};
19
20#[with_fallible_options]
21#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, MergeFrom)]
22pub struct LspSettingsMap(pub HashMap<Arc<str>, LspSettings>);
23
24impl IntoIterator for LspSettingsMap {
25 type Item = (Arc<str>, LspSettings);
26 type IntoIter = std::collections::hash_map::IntoIter<Arc<str>, LspSettings>;
27
28 fn into_iter(self) -> Self::IntoIter {
29 self.0.into_iter()
30 }
31}
32
33impl RootUserSettings for ProjectSettingsContent {
34 fn parse_json(json: &str) -> (Option<Self>, ParseStatus) {
35 fallible_options::parse_json(json)
36 }
37 fn parse_json_with_comments(json: &str) -> anyhow::Result<Self> {
38 parse_json_with_comments(json)
39 }
40}
41
42#[with_fallible_options]
43#[derive(Debug, PartialEq, Clone, Default, Serialize, Deserialize, JsonSchema, MergeFrom)]
44pub struct ProjectSettingsContent {
45 #[serde(flatten)]
46 pub all_languages: AllLanguageSettingsContent,
47
48 #[serde(flatten)]
49 pub worktree: WorktreeSettingsContent,
50
51 /// Configuration for language servers.
52 ///
53 /// The following settings can be overridden for specific language servers:
54 /// - initialization_options
55 ///
56 /// To override settings for a language, add an entry for that language server's
57 /// name to the lsp value.
58 /// Default: null
59 #[serde(default)]
60 pub lsp: LspSettingsMap,
61
62 pub terminal: Option<ProjectTerminalSettingsContent>,
63
64 /// Configuration for Debugger-related features
65 #[serde(default)]
66 pub dap: HashMap<Arc<str>, DapSettingsContent>,
67
68 /// Settings for context servers used for AI-related features.
69 #[serde(default)]
70 pub context_servers: HashMap<Arc<str>, ContextServerSettingsContent>,
71
72 /// Default timeout in seconds for context server tool calls.
73 /// Can be overridden per-server in context_servers configuration.
74 ///
75 /// Default: 60
76 pub context_server_timeout: Option<u64>,
77
78 /// Configuration for how direnv configuration should be loaded
79 pub load_direnv: Option<DirenvSettings>,
80
81 /// The list of custom Git hosting providers.
82 pub git_hosting_providers: Option<ExtendingVec<GitHostingProviderConfig>>,
83
84 /// Whether to disable all AI features in Zed.
85 ///
86 /// Default: false
87 pub disable_ai: Option<SaturatingBool>,
88}
89
90#[with_fallible_options]
91#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, JsonSchema, MergeFrom)]
92pub struct WorktreeSettingsContent {
93 /// The displayed name of this project. If not set or null, the root directory name
94 /// will be displayed.
95 ///
96 /// Default: null
97 pub project_name: Option<String>,
98
99 /// Whether to prevent this project from being shared in public channels.
100 ///
101 /// Default: false
102 #[serde(default)]
103 pub prevent_sharing_in_public_channels: bool,
104
105 /// Completely ignore files matching globs from `file_scan_exclusions`. Overrides
106 /// `file_scan_inclusions`.
107 ///
108 /// Default: [
109 /// "**/.git",
110 /// "**/.svn",
111 /// "**/.hg",
112 /// "**/.jj",
113 /// "**/CVS",
114 /// "**/.DS_Store",
115 /// "**/Thumbs.db",
116 /// "**/.classpath",
117 /// "**/.settings"
118 /// ]
119 pub file_scan_exclusions: Option<Vec<String>>,
120
121 /// Always include files that match these globs when scanning for files, even if they're
122 /// ignored by git. This setting is overridden by `file_scan_exclusions`.
123 /// Default: [
124 /// ".env*",
125 /// "docker-compose.*.yml",
126 /// ]
127 pub file_scan_inclusions: Option<Vec<String>>,
128
129 /// Treat the files matching these globs as `.env` files.
130 /// Default: ["**/.env*", "**/*.pem", "**/*.key", "**/*.cert", "**/*.crt", "**/secrets.yml"]
131 pub private_files: Option<ExtendingVec<String>>,
132
133 /// Treat the files matching these globs as hidden files. You can hide hidden files in the project panel.
134 /// Default: ["**/.*"]
135 pub hidden_files: Option<Vec<String>>,
136
137 /// Treat the files matching these globs as read-only. These files can be opened and viewed,
138 /// but cannot be edited. This is useful for generated files, build outputs, or files from
139 /// external dependencies that should not be modified directly.
140 /// Default: []
141 pub read_only_files: Option<Vec<String>>,
142}
143
144#[with_fallible_options]
145#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, JsonSchema, MergeFrom, Hash)]
146#[serde(rename_all = "snake_case")]
147pub struct LspSettings {
148 pub binary: Option<BinarySettings>,
149 /// Options passed to the language server at startup.
150 ///
151 /// Ref: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#initialize
152 ///
153 /// Consult the documentation for the specific language server to see which settings are supported.
154 pub initialization_options: Option<serde_json::Value>,
155 /// Language server settings.
156 ///
157 /// Ref: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_configuration
158 ///
159 /// Consult the documentation for the specific language server to see which settings are supported.
160 pub settings: Option<serde_json::Value>,
161 /// If the server supports sending tasks over LSP extensions,
162 /// this setting can be used to enable or disable them in Zed.
163 /// Default: true
164 #[serde(default = "default_true")]
165 pub enable_lsp_tasks: bool,
166 pub fetch: Option<FetchSettings>,
167}
168
169impl Default for LspSettings {
170 fn default() -> Self {
171 Self {
172 binary: None,
173 initialization_options: None,
174 settings: None,
175 enable_lsp_tasks: true,
176 fetch: None,
177 }
178 }
179}
180
181#[with_fallible_options]
182#[derive(
183 Clone, Debug, Default, Serialize, Deserialize, PartialEq, Eq, JsonSchema, MergeFrom, Hash,
184)]
185pub struct BinarySettings {
186 pub path: Option<String>,
187 pub arguments: Option<Vec<String>>,
188 pub env: Option<BTreeMap<String, String>>,
189 pub ignore_system_version: Option<bool>,
190}
191
192#[with_fallible_options]
193#[derive(
194 Clone, Debug, Default, Serialize, Deserialize, PartialEq, Eq, JsonSchema, MergeFrom, Hash,
195)]
196pub struct FetchSettings {
197 // Whether to consider pre-releases for fetching
198 pub pre_release: Option<bool>,
199}
200
201/// Common language server settings.
202#[with_fallible_options]
203#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, MergeFrom)]
204pub struct GlobalLspSettingsContent {
205 /// Whether to show the LSP servers button in the status bar.
206 ///
207 /// Default: `true`
208 pub button: Option<bool>,
209 /// The maximum amount of time to wait for responses from language servers, in seconds.
210 /// A value of `0` will result in no timeout being applied (causing all LSP responses to wait indefinitely until completed).
211 ///
212 /// Default: `120`
213 pub request_timeout: Option<u64>,
214 /// Settings for language server notifications
215 pub notifications: Option<LspNotificationSettingsContent>,
216 /// Rules for rendering LSP semantic tokens.
217 pub semantic_token_rules: Option<SemanticTokenRules>,
218}
219
220#[with_fallible_options]
221#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema, MergeFrom)]
222pub struct LspNotificationSettingsContent {
223 /// Timeout in milliseconds for automatically dismissing language server notifications.
224 /// Set to 0 to disable auto-dismiss.
225 ///
226 /// Default: 5000
227 pub dismiss_timeout_ms: Option<u64>,
228}
229
230/// Custom rules for rendering LSP semantic tokens.
231#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq, JsonSchema)]
232#[serde(transparent)]
233pub struct SemanticTokenRules {
234 pub rules: Vec<SemanticTokenRule>,
235}
236
237impl SemanticTokenRules {
238 pub const FILE_NAME: &'static str = "semantic_token_rules.json";
239
240 pub fn load(file_path: &Path) -> anyhow::Result<Self> {
241 let rules_content = std::fs::read(file_path).with_context(|| {
242 anyhow::anyhow!(
243 "Could not read semantic token rules from {}",
244 file_path.display()
245 )
246 })?;
247
248 serde_json_lenient::from_slice::<SemanticTokenRules>(&rules_content).with_context(|| {
249 anyhow::anyhow!(
250 "Failed to parse semantic token rules from {}",
251 file_path.display()
252 )
253 })
254 }
255}
256
257impl crate::merge_from::MergeFrom for SemanticTokenRules {
258 fn merge_from(&mut self, other: &Self) {
259 self.rules.splice(0..0, other.rules.iter().cloned());
260 }
261}
262
263#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq, JsonSchema)]
264#[serde(rename_all = "snake_case")]
265pub struct SemanticTokenRule {
266 pub token_type: Option<String>,
267 #[serde(default)]
268 pub token_modifiers: Vec<String>,
269 #[serde(default)]
270 pub style: Vec<String>,
271 pub foreground_color: Option<Rgba>,
272 pub background_color: Option<Rgba>,
273 pub underline: Option<SemanticTokenColorOverride>,
274 pub strikethrough: Option<SemanticTokenColorOverride>,
275 pub font_weight: Option<SemanticTokenFontWeight>,
276 pub font_style: Option<SemanticTokenFontStyle>,
277}
278
279#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, JsonSchema, MergeFrom)]
280#[serde(untagged)]
281pub enum SemanticTokenColorOverride {
282 InheritForeground(bool),
283 Replace(Rgba),
284}
285
286#[derive(
287 Copy,
288 Clone,
289 Debug,
290 Default,
291 Serialize,
292 Deserialize,
293 PartialEq,
294 Eq,
295 JsonSchema,
296 MergeFrom,
297 strum::VariantArray,
298 strum::VariantNames,
299)]
300#[serde(rename_all = "snake_case")]
301pub enum SemanticTokenFontWeight {
302 #[default]
303 Normal,
304 Bold,
305}
306
307#[derive(
308 Copy,
309 Clone,
310 Debug,
311 Default,
312 Serialize,
313 Deserialize,
314 PartialEq,
315 Eq,
316 JsonSchema,
317 MergeFrom,
318 strum::VariantArray,
319 strum::VariantNames,
320)]
321#[serde(rename_all = "snake_case")]
322pub enum SemanticTokenFontStyle {
323 #[default]
324 Normal,
325 Italic,
326}
327
328#[with_fallible_options]
329#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema, MergeFrom)]
330#[serde(rename_all = "snake_case")]
331pub struct DapSettingsContent {
332 pub binary: Option<String>,
333 pub args: Option<Vec<String>>,
334 pub env: Option<HashMap<String, String>>,
335}
336
337#[with_fallible_options]
338#[derive(
339 Default, Copy, Clone, PartialEq, Eq, Debug, Serialize, Deserialize, JsonSchema, MergeFrom,
340)]
341pub struct SessionSettingsContent {
342 /// Whether or not to restore unsaved buffers on restart.
343 ///
344 /// If this is true, user won't be prompted whether to save/discard
345 /// dirty files when closing the application.
346 ///
347 /// Default: true
348 pub restore_unsaved_buffers: Option<bool>,
349 /// Whether or not to skip worktree trust checks.
350 /// When trusted, project settings are synchronized automatically,
351 /// language and MCP servers are downloaded and started automatically.
352 ///
353 /// Default: false
354 pub trust_all_worktrees: Option<bool>,
355}
356
357#[derive(Deserialize, Serialize, Clone, PartialEq, Eq, JsonSchema, MergeFrom, Debug)]
358#[serde(untagged, rename_all = "snake_case")]
359pub enum ContextServerSettingsContent {
360 Stdio {
361 /// Whether the context server is enabled.
362 #[serde(default = "default_true")]
363 enabled: bool,
364 /// Whether to run the context server on the remote server when using remote development.
365 ///
366 /// If this is false, the context server will always run on the local machine.
367 ///
368 /// Default: false
369 #[serde(default)]
370 remote: bool,
371 #[serde(flatten)]
372 command: ContextServerCommand,
373 },
374 Http {
375 /// Whether the context server is enabled.
376 #[serde(default = "default_true")]
377 enabled: bool,
378 /// The URL of the remote context server.
379 url: String,
380 /// Optional headers to send.
381 #[serde(skip_serializing_if = "HashMap::is_empty", default)]
382 headers: HashMap<String, String>,
383 /// Timeout for tool calls in seconds. Defaults to global context_server_timeout if not specified.
384 timeout: Option<u64>,
385 },
386 Extension {
387 /// Whether the context server is enabled.
388 #[serde(default = "default_true")]
389 enabled: bool,
390 /// Whether to run the context server on the remote server when using remote development.
391 ///
392 /// If this is false, the context server will always run on the local machine.
393 ///
394 /// Default: false
395 #[serde(default)]
396 remote: bool,
397 /// The settings for this context server specified by the extension.
398 ///
399 /// Consult the documentation for the context server to see what settings
400 /// are supported.
401 settings: serde_json::Value,
402 },
403}
404
405impl ContextServerSettingsContent {
406 pub fn set_enabled(&mut self, enabled: bool) {
407 match self {
408 ContextServerSettingsContent::Stdio {
409 enabled: custom_enabled,
410 ..
411 } => {
412 *custom_enabled = enabled;
413 }
414 ContextServerSettingsContent::Extension {
415 enabled: ext_enabled,
416 ..
417 } => *ext_enabled = enabled,
418 ContextServerSettingsContent::Http {
419 enabled: remote_enabled,
420 ..
421 } => *remote_enabled = enabled,
422 }
423 }
424}
425
426#[with_fallible_options]
427#[derive(Deserialize, Serialize, Clone, PartialEq, Eq, JsonSchema, MergeFrom)]
428pub struct ContextServerCommand {
429 #[serde(rename = "command")]
430 pub path: PathBuf,
431 pub args: Vec<String>,
432 pub env: Option<HashMap<String, String>>,
433 /// Timeout for tool calls in seconds. Defaults to 60 if not specified.
434 pub timeout: Option<u64>,
435}
436
437impl std::fmt::Debug for ContextServerCommand {
438 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
439 let filtered_env = self.env.as_ref().map(|env| {
440 env.iter()
441 .map(|(k, v)| {
442 (
443 k,
444 if util::redact::should_redact(k) {
445 "[REDACTED]"
446 } else {
447 v
448 },
449 )
450 })
451 .collect::<Vec<_>>()
452 });
453
454 f.debug_struct("ContextServerCommand")
455 .field("path", &self.path)
456 .field("args", &self.args)
457 .field("env", &filtered_env)
458 .finish()
459 }
460}
461
462#[with_fallible_options]
463#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize, JsonSchema, MergeFrom)]
464pub struct GitSettings {
465 /// Whether or not to enable git integration.
466 ///
467 /// Default: true
468 #[serde(flatten)]
469 pub enabled: Option<GitEnabledSettings>,
470 /// Whether or not to show the git gutter.
471 ///
472 /// Default: tracked_files
473 pub git_gutter: Option<GitGutterSetting>,
474 /// Sets the debounce threshold (in milliseconds) after which changes are reflected in the git gutter.
475 ///
476 /// Default: 0
477 pub gutter_debounce: Option<u64>,
478 /// Whether or not to show git blame data inline in
479 /// the currently focused line.
480 ///
481 /// Default: on
482 pub inline_blame: Option<InlineBlameSettings>,
483 /// Git blame settings.
484 pub blame: Option<BlameSettings>,
485 /// Which information to show in the branch picker.
486 ///
487 /// Default: on
488 pub branch_picker: Option<BranchPickerSettingsContent>,
489 /// How hunks are displayed visually in the editor.
490 ///
491 /// Default: staged_hollow
492 pub hunk_style: Option<GitHunkStyleSetting>,
493 /// How file paths are displayed in the git gutter.
494 ///
495 /// Default: file_name_first
496 pub path_style: Option<GitPathStyle>,
497 /// Directory where git worktrees are created, relative to the repository
498 /// working directory.
499 ///
500 /// When the resolved directory is outside the project root, the
501 /// project's directory name is automatically appended so that
502 /// sibling repos don't collide. For example, with the default
503 /// `"../worktrees"` and a project at `~/code/zed`, worktrees are
504 /// created under `~/code/worktrees/zed/`.
505 ///
506 /// When the resolved directory is inside the project root, no
507 /// extra component is added (it's already project-scoped).
508 ///
509 /// Examples:
510 /// - `"../worktrees"` — `~/code/worktrees/<project>/` (default)
511 /// - `".git/zed-worktrees"` — `<project>/.git/zed-worktrees/`
512 /// - `"my-worktrees"` — `<project>/my-worktrees/`
513 ///
514 /// Trailing slashes are ignored.
515 ///
516 /// Default: ../worktrees
517 pub worktree_directory: Option<String>,
518}
519
520#[with_fallible_options]
521#[derive(Clone, Copy, Debug, PartialEq, Default, Serialize, Deserialize, JsonSchema, MergeFrom)]
522#[serde(rename_all = "snake_case")]
523pub struct GitEnabledSettings {
524 pub disable_git: Option<bool>,
525 pub enable_status: Option<bool>,
526 pub enable_diff: Option<bool>,
527}
528
529impl GitEnabledSettings {
530 pub fn is_git_status_enabled(&self) -> bool {
531 !self.disable_git.unwrap_or(false) && self.enable_status.unwrap_or(true)
532 }
533
534 pub fn is_git_diff_enabled(&self) -> bool {
535 !self.disable_git.unwrap_or(false) && self.enable_diff.unwrap_or(true)
536 }
537}
538
539#[derive(
540 Clone,
541 Copy,
542 Debug,
543 PartialEq,
544 Default,
545 Serialize,
546 Deserialize,
547 JsonSchema,
548 MergeFrom,
549 strum::VariantArray,
550 strum::VariantNames,
551)]
552#[serde(rename_all = "snake_case")]
553pub enum GitGutterSetting {
554 /// Show git gutter in tracked files.
555 #[default]
556 TrackedFiles,
557 /// Hide git gutter
558 Hide,
559}
560
561#[with_fallible_options]
562#[derive(Clone, Copy, Debug, PartialEq, Default, Serialize, Deserialize, JsonSchema, MergeFrom)]
563#[serde(rename_all = "snake_case")]
564pub struct InlineBlameSettings {
565 /// Whether or not to show git blame data inline in
566 /// the currently focused line.
567 ///
568 /// Default: true
569 pub enabled: Option<bool>,
570 /// Whether to only show the inline blame information
571 /// after a delay once the cursor stops moving.
572 ///
573 /// Default: 0
574 pub delay_ms: Option<DelayMs>,
575 /// The amount of padding between the end of the source line and the start
576 /// of the inline blame in units of columns.
577 ///
578 /// Default: 7
579 pub padding: Option<u32>,
580 /// The minimum column number to show the inline blame information at
581 ///
582 /// Default: 0
583 pub min_column: Option<u32>,
584 /// Whether to show commit summary as part of the inline blame.
585 ///
586 /// Default: false
587 pub show_commit_summary: Option<bool>,
588}
589
590#[with_fallible_options]
591#[derive(Clone, Copy, Debug, PartialEq, Default, Serialize, Deserialize, JsonSchema, MergeFrom)]
592#[serde(rename_all = "snake_case")]
593pub struct BlameSettings {
594 /// Whether to show the avatar of the author of the commit.
595 ///
596 /// Default: true
597 pub show_avatar: Option<bool>,
598}
599
600#[with_fallible_options]
601#[derive(Clone, Copy, PartialEq, Debug, Default, Serialize, Deserialize, JsonSchema, MergeFrom)]
602#[serde(rename_all = "snake_case")]
603pub struct BranchPickerSettingsContent {
604 /// Whether to show author name as part of the commit information.
605 ///
606 /// Default: false
607 pub show_author_name: Option<bool>,
608}
609
610#[derive(
611 Clone,
612 Copy,
613 PartialEq,
614 Debug,
615 Default,
616 Serialize,
617 Deserialize,
618 JsonSchema,
619 MergeFrom,
620 strum::VariantArray,
621 strum::VariantNames,
622)]
623#[serde(rename_all = "snake_case")]
624pub enum GitHunkStyleSetting {
625 /// Show unstaged hunks with a filled background and staged hunks hollow.
626 #[default]
627 StagedHollow,
628 /// Show unstaged hunks hollow and staged hunks with a filled background.
629 UnstagedHollow,
630}
631
632#[with_fallible_options]
633#[derive(
634 Copy,
635 Clone,
636 Debug,
637 PartialEq,
638 Default,
639 Serialize,
640 Deserialize,
641 JsonSchema,
642 MergeFrom,
643 strum::VariantArray,
644 strum::VariantNames,
645)]
646#[serde(rename_all = "snake_case")]
647pub enum GitPathStyle {
648 /// Show file name first, then path
649 #[default]
650 FileNameFirst,
651 /// Show full path first
652 FilePathFirst,
653}
654
655#[with_fallible_options]
656#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize, JsonSchema, MergeFrom)]
657pub struct DiagnosticsSettingsContent {
658 /// Whether to show the project diagnostics button in the status bar.
659 pub button: Option<bool>,
660
661 /// Whether or not to include warning diagnostics.
662 ///
663 /// Default: true
664 pub include_warnings: Option<bool>,
665
666 /// Settings for using LSP pull diagnostics mechanism in Zed.
667 pub lsp_pull_diagnostics: Option<LspPullDiagnosticsSettingsContent>,
668
669 /// Settings for showing inline diagnostics.
670 pub inline: Option<InlineDiagnosticsSettingsContent>,
671}
672
673#[with_fallible_options]
674#[derive(
675 Clone, Copy, Debug, Default, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq,
676)]
677pub struct LspPullDiagnosticsSettingsContent {
678 /// Whether to pull for diagnostics or not.
679 ///
680 /// Default: true
681 pub enabled: Option<bool>,
682 /// Minimum time to wait before pulling diagnostics from the language server(s).
683 /// 0 turns the debounce off.
684 ///
685 /// Default: 50
686 pub debounce_ms: Option<DelayMs>,
687}
688
689#[with_fallible_options]
690#[derive(
691 Clone, Copy, Debug, PartialEq, Default, Serialize, Deserialize, JsonSchema, MergeFrom, Eq,
692)]
693pub struct InlineDiagnosticsSettingsContent {
694 /// Whether or not to show inline diagnostics
695 ///
696 /// Default: false
697 pub enabled: Option<bool>,
698 /// Whether to only show the inline diagnostics after a delay after the
699 /// last editor event.
700 ///
701 /// Default: 150
702 pub update_debounce_ms: Option<DelayMs>,
703 /// The amount of padding between the end of the source line and the start
704 /// of the inline diagnostic in units of columns.
705 ///
706 /// Default: 4
707 pub padding: Option<u32>,
708 /// The minimum column to display inline diagnostics. This setting can be
709 /// used to horizontally align inline diagnostics at some position. Lines
710 /// longer than this value will still push diagnostics further to the right.
711 ///
712 /// Default: 0
713 pub min_column: Option<u32>,
714
715 pub max_severity: Option<DiagnosticSeverityContent>,
716}
717
718#[with_fallible_options]
719#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema, MergeFrom)]
720pub struct NodeBinarySettings {
721 /// The path to the Node binary.
722 pub path: Option<String>,
723 /// The path to the npm binary Zed should use (defaults to `.path/../npm`).
724 pub npm_path: Option<String>,
725 /// If enabled, Zed will download its own copy of Node.
726 pub ignore_system_version: Option<bool>,
727}
728
729#[derive(Clone, PartialEq, Debug, Default, Serialize, Deserialize, JsonSchema, MergeFrom)]
730#[serde(rename_all = "snake_case")]
731pub enum DirenvSettings {
732 /// Load direnv configuration through a shell hook
733 ShellHook,
734 /// Load direnv configuration directly using `direnv export json`
735 #[default]
736 Direct,
737 /// Do not load direnv configuration
738 Disabled,
739}
740
741#[derive(
742 Clone,
743 Copy,
744 Debug,
745 Eq,
746 PartialEq,
747 Ord,
748 PartialOrd,
749 Serialize,
750 Deserialize,
751 JsonSchema,
752 MergeFrom,
753 strum::VariantArray,
754 strum::VariantNames,
755)]
756#[serde(rename_all = "snake_case")]
757pub enum DiagnosticSeverityContent {
758 // No diagnostics are shown.
759 Off,
760 Error,
761 Warning,
762 Info,
763 Hint,
764 All,
765}
766
767/// A custom Git hosting provider.
768#[with_fallible_options]
769#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, JsonSchema, MergeFrom)]
770pub struct GitHostingProviderConfig {
771 /// The type of the provider.
772 ///
773 /// Must be one of `github`, `gitlab`, `bitbucket`, `gitea`, `forgejo`, or `source_hut`.
774 pub provider: GitHostingProviderKind,
775
776 /// The base URL for the provider (e.g., "https://code.corp.big.com").
777 pub base_url: String,
778
779 /// The display name for the provider (e.g., "BigCorp GitHub").
780 pub name: String,
781}
782
783#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, MergeFrom)]
784#[serde(rename_all = "snake_case")]
785pub enum GitHostingProviderKind {
786 Github,
787 Gitlab,
788 Bitbucket,
789 Gitea,
790 Forgejo,
791 SourceHut,
792}