on master help sign in
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.

commitc1f677ff75d6a2932175722c92c3d42c30515b48 authorMichael Davis <mcarsondavis@gmail.com> dateMon 14 Feb 2022, 11:24 (5 years ago) parenteeb3f8e
2 files changed+3−5
helix-core/src/indent.rs+1−1 helix-core/src/syntax.rs+2−4
helix-core/src/indent.rs+1−1
@@ -433,7 +433,7 @@ where
433433 comment_token: None,
434434 auto_format: false,
435435 diagnostic_severity: Severity::Warning,
436− tree_sitter_library: None,
436+ grammar: None,
437437 language_server: None,
438438 indent: Some(IndentationConfiguration {
439439 tab_width: 4,
helix-core/src/syntax.rs+2−4
@@ -108,7 +108,7 @@ pub struct LanguageConfiguration {
108108 #[serde(default)]
109109 pub diagnostic_severity: Severity,
110110
111− pub tree_sitter_library: Option<String>, // tree-sitter library name, defaults to language_id
111+ pub grammar: Option<String>, // tree-sitter grammar name, defaults to language_id
112112
113113 // content_regex
114114 #[serde(default, skip_serializing, deserialize_with = "deserialize_regex")]
@@ -444,9 +444,7 @@ impl LanguageConfiguration {
444444 } else {
445445 let language = get_language(
446446 &crate::RUNTIME_DIR,
447− self.tree_sitter_library
448− .as_deref()
449− .unwrap_or(&self.language_id),
447+ self.grammar.as_deref().unwrap_or(&self.language_id),
450448 )
451449 .map_err(|e| log::info!("{}", e))
452450 .ok()?;