aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Davis2022-02-14 17:24:28 +0000
committerBlaž Hrastnik2022-03-10 08:31:57 +0000
commitc1f677ff75d6a2932175722c92c3d42c30515b48 (patch)
tree1c68d9f24bcae6d442e94e3b7ceba2a9f94dd031
parenteeb3f8e9639e68ea2d54a6be26d45543d01057f6 (diff)
rename tree_sitter_library in LanguageConfig to 'grammar'
This is not strictly speaking necessary. tree_sitter_library was used by just one grammar: llvm-mir-yaml, which uses the yaml grammar. This will make the language more consistent, though. Each language can explicitly say that they use Some(grammar), defaulting when None to the grammar that has a grammar_id matching the language's language_id.
-rw-r--r--helix-core/src/indent.rs2
-rw-r--r--helix-core/src/syntax.rs6
2 files changed, 3 insertions, 5 deletions
diff --git a/helix-core/src/indent.rs b/helix-core/src/indent.rs
index 83b2be94..ba02065c 100644
--- a/helix-core/src/indent.rs
+++ b/helix-core/src/indent.rs
@@ -433,7 +433,7 @@ where
comment_token: None,
auto_format: false,
diagnostic_severity: Severity::Warning,
- tree_sitter_library: None,
+ grammar: None,
language_server: None,
indent: Some(IndentationConfiguration {
tab_width: 4,
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs
index 0f7d224d..038fbfdd 100644
--- a/helix-core/src/syntax.rs
+++ b/helix-core/src/syntax.rs
@@ -108,7 +108,7 @@ pub struct LanguageConfiguration {
#[serde(default)]
pub diagnostic_severity: Severity,
- pub tree_sitter_library: Option<String>, // tree-sitter library name, defaults to language_id
+ pub grammar: Option<String>, // tree-sitter grammar name, defaults to language_id
// content_regex
#[serde(default, skip_serializing, deserialize_with = "deserialize_regex")]
@@ -444,9 +444,7 @@ impl LanguageConfiguration {
} else {
let language = get_language(
&crate::RUNTIME_DIR,
- self.tree_sitter_library
- .as_deref()
- .unwrap_or(&self.language_id),
+ self.grammar.as_deref().unwrap_or(&self.language_id),
)
.map_err(|e| log::info!("{}", e))
.ok()?;