fix(init): use current path if unspecified
This commit is contained in:
parent
8681960fbc
commit
f9a4e8ecdc
2 changed files with 5 additions and 4 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ impl JsonConfigOpts {
|
|||
name: self.name.clone(),
|
||||
camelcase: Some(self.camelcase),
|
||||
scope: self.scope,
|
||||
path: PathBuf::from("."),
|
||||
path: None,
|
||||
external_files: PathsJSON::Empty,
|
||||
file_types: None,
|
||||
highlights: PathsJSON::Empty,
|
||||
|
|
@ -234,7 +234,7 @@ pub fn migrate_package_json(repo_path: &Path) -> Result<bool> {
|
|||
name: name.clone(),
|
||||
camelcase: Some(name.to_upper_camel_case()),
|
||||
scope: l.scope.unwrap_or_else(|| format!("source.{name}")),
|
||||
path: l.path,
|
||||
path: Some(l.path),
|
||||
external_files: l.external_files,
|
||||
file_types: l.file_types,
|
||||
highlights: l.highlights,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue