changeset 828:2033a1460dbc

feat: add hg-commit and hgrc tree-sitter grammars and highlights
author zegervdv <zegervdv@me.com>
date Wed, 03 Jan 2024 11:43:45 +0100
parents e4d67607d020
children bd41aac927e6
files dot_config/helix/languages.toml dot_config/helix/runtime/queries/hg-commit/highlights.scm dot_config/helix/runtime/queries/hg-commit/injections.scm dot_config/helix/runtime/queries/hgrc/highlights.scm
diffstat 4 files changed, 51 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dot_config/helix/languages.toml	Wed Jan 03 11:42:18 2024 +0100
+++ b/dot_config/helix/languages.toml	Wed Jan 03 11:43:45 2024 +0100
@@ -33,7 +33,7 @@
 
 [[grammar]]
 name = "hgrc"
-source = { git = "https://github.com/zegervdv/tree-sitter-hgrc.git", rev = "d20aa925aa0c56d68215395b9e65dc6003cdcffb" }
+source = { git = "https://github.com/zegervdv/tree-sitter-hgrc.git", rev = "6bbb8cc15cd489b66244517c3c5bbf4b19fd8ffa" }
 
 [[language]]
 name = "hgrc"
@@ -43,3 +43,16 @@
 comment-token = "#"
 indent = { tab-width = 2, unit = " " }
 roots = [".hg"]
+
+[[grammar]]
+name = "hg-commit"
+source = { git = "https://github.com/zegervdv/tree-sitter-hg-commit.git", rev = "310825fccba24d27d9da66597c372f697896a6d3" }
+
+[[language]]
+name = "hg-commit"
+scope = "source.hg-commit"
+injection-regex = "hgrc"
+file-types = [{ suffix = "commit.hg.txt" }]
+comment-token = "HG:"
+indent = { tab-width = 2, unit = " " }
+roots = [".hg"]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dot_config/helix/runtime/queries/hg-commit/highlights.scm	Wed Jan 03 11:43:45 2024 +0100
@@ -0,0 +1,19 @@
+(subject) @markup.heading
+(path) @string.special.path
+(commit) @constant
+(item) @markup.link.url
+
+(change kind: "added" @diff.plus)
+(change kind: "removed" @diff.minus)
+(change kind: "changed" @diff.delta)
+
+(meta
+  key: (meta_key) @type
+  value: (meta_value) @string)
+
+(trailer
+  key: (trailer_key) @variable.other.member
+  value: (trailer_value) @string)
+
+[":" "=" "->" (scissors)] @punctuation.delimiter
+(comment) @comment
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dot_config/helix/runtime/queries/hg-commit/injections.scm	Wed Jan 03 11:43:45 2024 +0100
@@ -0,0 +1,4 @@
+(((scissors)
+  (message) @injection.content)
+ (#set! injection.include-children)
+ (#set! injection.language "diff"))
--- a/dot_config/helix/runtime/queries/hgrc/highlights.scm	Wed Jan 03 11:42:18 2024 +0100
+++ b/dot_config/helix/runtime/queries/hgrc/highlights.scm	Wed Jan 03 11:43:45 2024 +0100
@@ -9,3 +9,17 @@
 (bool) @constant.builtin.boolean
 
 (comment) @comment
+
+(template
+  "{" @punctuation.special
+  "}" @punctuation.special)
+
+(template (number) @number)
+(template (bool) @constant.builtin.boolean)
+
+(function) @function
+(keyword) @keyword
+
+(operator) @operator
+
+(string (escape) @constant.character.escape)