fix(init): use current path if unspecified

This commit is contained in:
ObserverOfTime 2024-10-16 17:19:52 +03:00 committed by Amaan Qureshi
parent 8681960fbc
commit f9a4e8ecdc
2 changed files with 5 additions and 4 deletions

View file

@ -164,7 +164,8 @@ pub struct Grammar {
#[serde(skip_serializing_if = "Option::is_none")]
pub camelcase: Option<String>,
pub scope: String,
pub path: PathBuf,
#[serde(skip_serializing_if = "Option::is_none")]
pub path: Option<PathBuf>,
#[serde(default, skip_serializing_if = "PathsJSON::is_empty")]
pub external_files: PathsJSON,
pub file_types: Option<Vec<String>>,
@ -1114,7 +1115,7 @@ impl Loader {
// Determine the path to the parser directory. This can be specified in
// the tree-sitter.json, but defaults to the directory containing the
// tree-sitter.json.
let language_path = parser_path.join(grammar.path);
let language_path = parser_path.join(grammar.path.unwrap_or(PathBuf::from(".")));
// Determine if a previous language configuration in this package.json file
// already uses the same language.