diff --git a/cli/config/src/lib.rs b/cli/config/src/lib.rs index 678688fe..27b2dfb6 100644 --- a/cli/config/src/lib.rs +++ b/cli/config/src/lib.rs @@ -81,7 +81,13 @@ impl Config { /// /// (Note that this is typically only done by the `tree-sitter init-config` command.) pub fn initial() -> Result { - let location = Self::xdg_config_file()?; + let location = if let Ok(path) = env::var("TREE_SITTER_DIR") { + let mut path = PathBuf::from(path); + path.push("config.json"); + path + } else { + Self::xdg_config_file()? + }; let config = serde_json::json!({}); Ok(Config { location, config }) }