aboutsummaryrefslogtreecommitdiff
path: root/helix-core
diff options
context:
space:
mode:
authorSebastian Neubauer2022-01-04 01:52:34 +0000
committerGitHub2022-01-04 01:52:34 +0000
commit641255ccc83648d164bf6e8e8e4e93460591830b (patch)
treef10cda6e28a76fb696ef4559b3068e523e71962f /helix-core
parent7c9d3682db8310286c309cb10828b02046246a8e (diff)
Add llvm-mir highlighting (#1398)
* Add injection regex for more languages To support embedding them in other languages like markdown. * Add llvm-mir highlighting LLVM Machine IR is dumped as yaml files that can embed LLVM IR and Machine IR. To support this, add a llvm-mir-yaml language that uses the yaml parser, but uses different injections to highlight IR and MIR. * Update submodule with fixed multiline comments Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
Diffstat (limited to 'helix-core')
-rw-r--r--helix-core/src/indent.rs1
-rw-r--r--helix-core/src/syntax.rs13
2 files changed, 11 insertions, 3 deletions
diff --git a/helix-core/src/indent.rs b/helix-core/src/indent.rs
index 28066aa6..1fc2b8a5 100644
--- a/helix-core/src/indent.rs
+++ b/helix-core/src/indent.rs
@@ -436,6 +436,7 @@ where
comment_token: None,
auto_format: false,
diagnostic_severity: Severity::Warning,
+ tree_sitter_library: 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 cdae0210..5d37c219 100644
--- a/helix-core/src/syntax.rs
+++ b/helix-core/src/syntax.rs
@@ -67,6 +67,8 @@ pub struct LanguageConfiguration {
#[serde(default)]
pub diagnostic_severity: Severity,
+ pub tree_sitter_library: Option<String>, // tree-sitter library name, defaults to language_id
+
// content_regex
#[serde(default, skip_serializing, deserialize_with = "deserialize_regex")]
pub injection_regex: Option<Regex>,
@@ -192,9 +194,14 @@ impl LanguageConfiguration {
if highlights_query.is_empty() {
None
} else {
- let language = get_language(&crate::RUNTIME_DIR, &self.language_id)
- .map_err(|e| log::info!("{}", e))
- .ok()?;
+ let language = get_language(
+ &crate::RUNTIME_DIR,
+ self.tree_sitter_library
+ .as_deref()
+ .unwrap_or(&self.language_id),
+ )
+ .map_err(|e| log::info!("{}", e))
+ .ok()?;
let config = HighlightConfiguration::new(
language,
&highlights_query,