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.
pull/1784/head
Michael Davis 3 years ago committed by Blaž Hrastnik
parent eeb3f8e963
commit c1f677ff75

@ -433,7 +433,7 @@ where
comment_token: None, comment_token: None,
auto_format: false, auto_format: false,
diagnostic_severity: Severity::Warning, diagnostic_severity: Severity::Warning,
tree_sitter_library: None, grammar: None,
language_server: None, language_server: None,
indent: Some(IndentationConfiguration { indent: Some(IndentationConfiguration {
tab_width: 4, tab_width: 4,

@ -108,7 +108,7 @@ pub struct LanguageConfiguration {
#[serde(default)] #[serde(default)]
pub diagnostic_severity: Severity, 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 // content_regex
#[serde(default, skip_serializing, deserialize_with = "deserialize_regex")] #[serde(default, skip_serializing, deserialize_with = "deserialize_regex")]
@ -444,9 +444,7 @@ impl LanguageConfiguration {
} else { } else {
let language = get_language( let language = get_language(
&crate::RUNTIME_DIR, &crate::RUNTIME_DIR,
self.tree_sitter_library self.grammar.as_deref().unwrap_or(&self.language_id),
.as_deref()
.unwrap_or(&self.language_id),
) )
.map_err(|e| log::info!("{}", e)) .map_err(|e| log::info!("{}", e))
.ok()?; .ok()?;

Loading…
Cancel
Save