Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace submodules with flags for fetching and building grammars #1659

Merged
merged 18 commits into from
Mar 10, 2022
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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.
  • Loading branch information
the-mikedavis committed Mar 9, 2022
commit c824ad43ff8b594c625e028e58c0737aa4e4c2ea
2 changes: 1 addition & 1 deletion helix-core/src/indent.rs
Original file line number Diff line number Diff line change
@@ -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,
6 changes: 2 additions & 4 deletions helix-core/src/syntax.rs
Original file line number Diff line number Diff line change
@@ -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()?;