cli: Make init-config respect TREE_SITTER_DIR
This commit is contained in:
parent
eb970a83a1
commit
adeb8d0aa9
1 changed files with 7 additions and 1 deletions
|
|
@ -81,7 +81,13 @@ impl Config {
|
|||
///
|
||||
/// (Note that this is typically only done by the `tree-sitter init-config` command.)
|
||||
pub fn initial() -> Result<Config> {
|
||||
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 })
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue