Add diff syntax highlighting

This commit is contained in:
Sebastian Martinez
2025-05-21 08:31:27 +02:00
parent bc600c79a0
commit 9c12f3ae7f
3 changed files with 23 additions and 0 deletions
Generated
+11
View File
@@ -4105,6 +4105,7 @@ dependencies = [
"tree-sitter-bash",
"tree-sitter-c",
"tree-sitter-css",
"tree-sitter-diff",
"tree-sitter-go",
"tree-sitter-highlight",
"tree-sitter-html",
@@ -6138,6 +6139,16 @@ dependencies = [
"tree-sitter-language",
]
[[package]]
name = "tree-sitter-diff"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfe1e5ca280a65dfe5ba4205c1bcc84edf486464fed315db53dee6da9a335889"
dependencies = [
"cc",
"tree-sitter-language",
]
[[package]]
name = "tree-sitter-go"
version = "0.23.4"
+1
View File
@@ -24,6 +24,7 @@ thiserror = { version = "2.0.12" }
tree-sitter-bash = { version = "0.23.3" }
tree-sitter-c = { version = "0.23.2" }
tree-sitter-css = { version = "0.23.1" }
tree-sitter-diff = { version = "0.1.0" }
tree-sitter-go = { version = "0.23.4" }
tree-sitter-highlight = { version = "0.25.3" }
tree-sitter-html = { version = "0.23.2" }
+11
View File
@@ -250,6 +250,7 @@ impl Highlighter {
("rust", Self::config("rust")),
("json", Self::config("json")),
("jsdoc", Self::config("jsdoc")),
("diff", Self::config("diff")),
("typescript", Self::config("typescript")),
("javascript", Self::config("javascript")),
("markdown", Self::config("markdown")),
@@ -337,6 +338,16 @@ impl Highlighter {
)
.expect("Highlighter::config: highlight configuration must be valid"),
),
"diff" => Some(
ts::HighlightConfiguration::new(
tree_sitter_diff::LANGUAGE.into(),
language,
tree_sitter_diff::HIGHLIGHTS_QUERY,
"",
"",
)
.expect("Highlighter::config: highlight configuration must be valid"),
),
"json" => Some(
ts::HighlightConfiguration::new(
tree_sitter_json::LANGUAGE.into(),