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(Copy, 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}
477
478#[with_fallible_options]
479#[derive(Clone, Copy, Debug, PartialEq, Default, Serialize, Deserialize, JsonSchema, MergeFrom)]
480#[serde(rename_all = "snake_case")]
481pub struct GitEnabledSettings {
482 pub disable_git: Option<bool>,
483 pub enable_status: Option<bool>,
484 pub enable_diff: Option<bool>,
485}
486
487impl GitEnabledSettings {
488 pub fn is_git_status_enabled(&self) -> bool {
489 !self.disable_git.unwrap_or(false) && self.enable_status.unwrap_or(true)
490 }
491
492 pub fn is_git_diff_enabled(&self) -> bool {
493 !self.disable_git.unwrap_or(false) && self.enable_diff.unwrap_or(true)
494 }
495}
496
497#[derive(
498 Clone,
499 Copy,
500 Debug,
501 PartialEq,
502 Default,
503 Serialize,
504 Deserialize,
505 JsonSchema,
506 MergeFrom,
507 strum::VariantArray,
508 strum::VariantNames,
509)]
510#[serde(rename_all = "snake_case")]
511pub enum GitGutterSetting {
512 /// Show git gutter in tracked files.
513 #[default]
514 TrackedFiles,
515 /// Hide git gutter
516 Hide,
517}
518
519#[with_fallible_options]
520#[derive(Clone, Copy, Debug, PartialEq, Default, Serialize, Deserialize, JsonSchema, MergeFrom)]
521#[serde(rename_all = "snake_case")]
522pub struct InlineBlameSettings {
523 /// Whether or not to show git blame data inline in
524 /// the currently focused line.
525 ///
526 /// Default: true
527 pub enabled: Option<bool>,
528 /// Whether to only show the inline blame information
529 /// after a delay once the cursor stops moving.
530 ///
531 /// Default: 0
532 pub delay_ms: Option<DelayMs>,
533 /// The amount of padding between the end of the source line and the start
534 /// of the inline blame in units of columns.
535 ///
536 /// Default: 7
537 pub padding: Option<u32>,
538 /// The minimum column number to show the inline blame information at
539 ///
540 /// Default: 0
541 pub min_column: Option<u32>,
542 /// Whether to show commit summary as part of the inline blame.
543 ///
544 /// Default: false
545 pub show_commit_summary: Option<bool>,
546}
547
548#[with_fallible_options]
549#[derive(Clone, Copy, Debug, PartialEq, Default, Serialize, Deserialize, JsonSchema, MergeFrom)]
550#[serde(rename_all = "snake_case")]
551pub struct BlameSettings {
552 /// Whether to show the avatar of the author of the commit.
553 ///
554 /// Default: true
555 pub show_avatar: Option<bool>,
556}
557
558#[with_fallible_options]
559#[derive(Clone, Copy, PartialEq, Debug, Default, Serialize, Deserialize, JsonSchema, MergeFrom)]
560#[serde(rename_all = "snake_case")]
561pub struct BranchPickerSettingsContent {
562 /// Whether to show author name as part of the commit information.
563 ///
564 /// Default: false
565 pub show_author_name: Option<bool>,
566}
567
568#[derive(
569 Clone,
570 Copy,
571 PartialEq,
572 Debug,
573 Default,
574 Serialize,
575 Deserialize,
576 JsonSchema,
577 MergeFrom,
578 strum::VariantArray,
579 strum::VariantNames,
580)]
581#[serde(rename_all = "snake_case")]
582pub enum GitHunkStyleSetting {
583 /// Show unstaged hunks with a filled background and staged hunks hollow.
584 #[default]
585 StagedHollow,
586 /// Show unstaged hunks hollow and staged hunks with a filled background.
587 UnstagedHollow,
588}
589
590#[with_fallible_options]
591#[derive(
592 Copy,
593 Clone,
594 Debug,
595 PartialEq,
596 Default,
597 Serialize,
598 Deserialize,
599 JsonSchema,
600 MergeFrom,
601 strum::VariantArray,
602 strum::VariantNames,
603)]
604#[serde(rename_all = "snake_case")]
605pub enum GitPathStyle {
606 /// Show file name first, then path
607 #[default]
608 FileNameFirst,
609 /// Show full path first
610 FilePathFirst,
611}
612
613#[with_fallible_options]
614#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize, JsonSchema, MergeFrom)]
615pub struct DiagnosticsSettingsContent {
616 /// Whether to show the project diagnostics button in the status bar.
617 pub button: Option<bool>,
618
619 /// Whether or not to include warning diagnostics.
620 ///
621 /// Default: true
622 pub include_warnings: Option<bool>,
623
624 /// Settings for using LSP pull diagnostics mechanism in Zed.
625 pub lsp_pull_diagnostics: Option<LspPullDiagnosticsSettingsContent>,
626
627 /// Settings for showing inline diagnostics.
628 pub inline: Option<InlineDiagnosticsSettingsContent>,
629}
630
631#[with_fallible_options]
632#[derive(
633 Clone, Copy, Debug, Default, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq, Eq,
634)]
635pub struct LspPullDiagnosticsSettingsContent {
636 /// Whether to pull for diagnostics or not.
637 ///
638 /// Default: true
639 pub enabled: Option<bool>,
640 /// Minimum time to wait before pulling diagnostics from the language server(s).
641 /// 0 turns the debounce off.
642 ///
643 /// Default: 50
644 pub debounce_ms: Option<DelayMs>,
645}
646
647#[with_fallible_options]
648#[derive(
649 Clone, Copy, Debug, PartialEq, Default, Serialize, Deserialize, JsonSchema, MergeFrom, Eq,
650)]
651pub struct InlineDiagnosticsSettingsContent {
652 /// Whether or not to show inline diagnostics
653 ///
654 /// Default: false
655 pub enabled: Option<bool>,
656 /// Whether to only show the inline diagnostics after a delay after the
657 /// last editor event.
658 ///
659 /// Default: 150
660 pub update_debounce_ms: Option<DelayMs>,
661 /// The amount of padding between the end of the source line and the start
662 /// of the inline diagnostic in units of columns.
663 ///
664 /// Default: 4
665 pub padding: Option<u32>,
666 /// The minimum column to display inline diagnostics. This setting can be
667 /// used to horizontally align inline diagnostics at some position. Lines
668 /// longer than this value will still push diagnostics further to the right.
669 ///
670 /// Default: 0
671 pub min_column: Option<u32>,
672
673 pub max_severity: Option<DiagnosticSeverityContent>,
674}
675
676#[with_fallible_options]
677#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema, MergeFrom)]
678pub struct NodeBinarySettings {
679 /// The path to the Node binary.
680 pub path: Option<String>,
681 /// The path to the npm binary Zed should use (defaults to `.path/../npm`).
682 pub npm_path: Option<String>,
683 /// If enabled, Zed will download its own copy of Node.
684 pub ignore_system_version: Option<bool>,
685}
686
687#[derive(Clone, PartialEq, Debug, Default, Serialize, Deserialize, JsonSchema, MergeFrom)]
688#[serde(rename_all = "snake_case")]
689pub enum DirenvSettings {
690 /// Load direnv configuration through a shell hook
691 ShellHook,
692 /// Load direnv configuration directly using `direnv export json`
693 #[default]
694 Direct,
695 /// Do not load direnv configuration
696 Disabled,
697}
698
699#[derive(
700 Clone,
701 Copy,
702 Debug,
703 Eq,
704 PartialEq,
705 Ord,
706 PartialOrd,
707 Serialize,
708 Deserialize,
709 JsonSchema,
710 MergeFrom,
711 strum::VariantArray,
712 strum::VariantNames,
713)]
714#[serde(rename_all = "snake_case")]
715pub enum DiagnosticSeverityContent {
716 // No diagnostics are shown.
717 Off,
718 Error,
719 Warning,
720 Info,
721 Hint,
722 All,
723}
724
725/// A custom Git hosting provider.
726#[with_fallible_options]
727#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, JsonSchema, MergeFrom)]
728pub struct GitHostingProviderConfig {
729 /// The type of the provider.
730 ///
731 /// Must be one of `github`, `gitlab`, `bitbucket`, `gitea`, `forgejo`, or `source_hut`.
732 pub provider: GitHostingProviderKind,
733
734 /// The base URL for the provider (e.g., "https://code.corp.big.com").
735 pub base_url: String,
736
737 /// The display name for the provider (e.g., "BigCorp GitHub").
738 pub name: String,
739}
740
741#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, MergeFrom)]
742#[serde(rename_all = "snake_case")]
743pub enum GitHostingProviderKind {
744 Github,
745 Gitlab,
746 Bitbucket,
747 Gitea,
748 Forgejo,
749 SourceHut,
750}