project.rs

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