Skip to content

Commit

Permalink
feat(config): include warn by default
Browse files Browse the repository at this point in the history
Signed-off-by: loongtao.zhang <[email protected]>
  • Loading branch information
cathaysia committed Feb 9, 2025
1 parent 9472366 commit 53e503f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
1 change: 0 additions & 1 deletion config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
vscode_version = "1.84.2"
autogen_warning = "# Warning, this file is autogenerated by nix4vscode. Don't modify this manually."

extensions = [
"ms-python.debugpy",
Expand Down
17 changes: 16 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub enum ExtensionType {
V2(String),
}

#[derive(Debug, Default, Serialize, Deserialize, Clone)]
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(default)]
pub struct Config {
pub vscode_version: String,
Expand All @@ -25,6 +25,21 @@ pub struct Config {
pub(crate) handled_extensions: Vec<Extension>,
}

impl Default for Config {
fn default() -> Self {
Self {
vscode_version: Default::default(),
autogen_warning: Some(
"# Warning, this file is autogenerated by nix4vscode. Don't modify this manually."
.into(),
),
extensions: Default::default(),
system: None,
handled_extensions: Default::default(),
}
}
}

impl Config {
pub async fn from_file(path: &str) -> anyhow::Result<Self> {
let content = fs::read_to_string(path).await?;
Expand Down

0 comments on commit 53e503f

Please sign in to comment.