aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules4
-rw-r--r--book/src/generated/lang-support.md1
m---------helix-syntax/languages/tree-sitter-git-rebase0
-rw-r--r--languages.toml9
-rw-r--r--runtime/queries/git-commit/highlights.scm1
-rw-r--r--runtime/queries/git-commit/injections.scm8
-rw-r--r--runtime/queries/git-rebase/highlights.scm11
-rw-r--r--runtime/queries/git-rebase/injections.scm4
8 files changed, 32 insertions, 6 deletions
diff --git a/.gitmodules b/.gitmodules
index 422671b4..22f70c80 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -178,3 +178,7 @@
path = helix-syntax/languages/tree-sitter-git-diff
url = https://github.com/the-mikedavis/tree-sitter-git-diff.git
shallow = true
+[submodule "helix-syntax/languages/tree-sitter-git-rebase"]
+ path = helix-syntax/languages/tree-sitter-git-rebase
+ url = https://github.com/the-mikedavis/tree-sitter-git-rebase.git
+ shallow = true
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index 91575c62..09284d46 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -13,6 +13,7 @@
| fish | ✓ | ✓ | ✓ | |
| git-commit | ✓ | | | |
| git-diff | ✓ | | | |
+| git-rebase | ✓ | | | |
| glsl | ✓ | | ✓ | |
| go | ✓ | ✓ | ✓ | `gopls` |
| html | ✓ | | | |
diff --git a/helix-syntax/languages/tree-sitter-git-rebase b/helix-syntax/languages/tree-sitter-git-rebase
new file mode 160000
+Subproject 332dc528f27044bc4427024dbb33e6941fc131f
diff --git a/languages.toml b/languages.toml
index c3ae9f62..3d9bac7b 100644
--- a/languages.toml
+++ b/languages.toml
@@ -490,3 +490,12 @@ file-types = ["diff"]
injection-regex = "diff"
comment-token = "#"
indent = { tab-width = 2, unit = " " }
+
+[[language]]
+name = "git-rebase"
+scope = "source.gitrebase"
+roots = []
+file-types = ["git-rebase-todo"]
+injection-regex = "git-rebase"
+comment-token = "#"
+indent = { tab-width = 2, unit = " " }
diff --git a/runtime/queries/git-commit/highlights.scm b/runtime/queries/git-commit/highlights.scm
index ffcc31ae..0b50d419 100644
--- a/runtime/queries/git-commit/highlights.scm
+++ b/runtime/queries/git-commit/highlights.scm
@@ -4,7 +4,6 @@
(commit) @constant
(item) @markup.link.url
(header) @tag
-(rebase_command) @markup.raw
(change kind: "new file" @diff.plus)
(change kind: "deleted" @diff.minus)
diff --git a/runtime/queries/git-commit/injections.scm b/runtime/queries/git-commit/injections.scm
index bd96f1de..cf0657f7 100644
--- a/runtime/queries/git-commit/injections.scm
+++ b/runtime/queries/git-commit/injections.scm
@@ -3,8 +3,6 @@
(#set! injection.include-children)
(#set! injection.language "diff"))
-; once a rebase grammar is available, we can inject rebase highlighting into
-; interactive rebase summary sections like so:
-;
-; ((rebase_command) @injection.content
-; (#set! injection.language "git-rebase"))
+((rebase_command) @injection.content
+ (#set! injection.include-children)
+ (#set! injection.language "git-rebase"))
diff --git a/runtime/queries/git-rebase/highlights.scm b/runtime/queries/git-rebase/highlights.scm
new file mode 100644
index 00000000..4f007037
--- /dev/null
+++ b/runtime/queries/git-rebase/highlights.scm
@@ -0,0 +1,11 @@
+(operation operator: ["p" "pick" "r" "reword" "e" "edit" "s" "squash" "m" "merge" "d" "drop" "b" "break" "x" "exec"] @keyword)
+(operation operator: ["l" "label" "t" "reset"] @function)
+(operation operator: ["f" "fixup"] @function.special)
+
+(option) @operator
+(label) @string.special.symbol
+(commit) @constant
+"#" @punctuation.delimiter
+(comment) @comment
+
+(ERROR) @error
diff --git a/runtime/queries/git-rebase/injections.scm b/runtime/queries/git-rebase/injections.scm
new file mode 100644
index 00000000..070129b6
--- /dev/null
+++ b/runtime/queries/git-rebase/injections.scm
@@ -0,0 +1,4 @@
+((operation
+ operator: ["x" "exec"]
+ (command) @injection.content)
+ (#set! injection.language "bash"))