vtcode_config/core/
desktop.rs1use serde::{Deserialize, Serialize};
7
8#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
10#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
11#[serde(rename_all = "kebab-case")]
12pub struct DesktopConfig {
13 #[serde(default = "default_suggest_install")]
16 pub suggest_install: bool,
17}
18
19impl Default for DesktopConfig {
20 fn default() -> Self {
21 Self { suggest_install: default_suggest_install() }
22 }
23}
24
25fn default_suggest_install() -> bool {
26 true
27}
28
29#[cfg(test)]
30mod tests {
31 use super::*;
32
33 #[test]
34 fn suggest_install_defaults_on() {
35 assert!(DesktopConfig::default().suggest_install);
36 let parsed: DesktopConfig = toml::from_str("").expect("empty table parses");
38 assert!(parsed.suggest_install);
39 }
40
41 #[test]
42 fn suggest_install_opt_out_parses() {
43 let parsed: DesktopConfig = toml::from_str("suggest-install = false").expect("opt-out parses");
44 assert!(!parsed.suggest_install);
45 }
46}