on master help sign in
add tree-sitter-git-rebase (#1402)

* add submodule on tree-sitter-rebase, add to languages * add basic highlights query * inject bash in execute statements * update tree-sitter-rebase * tree-sitter-rebase->tree-sitter-git-rebase * get injection working with tree-sitter-git-commit * set scope under source.gitrebase * unset include-children on commit message injections * Revert "unset include-children on commit message injections" This reverts commit 2ecee155ea8e229651920b291062c2ee84b47944. * fix generated language docs * use rebase_command scopes from tree-sitter-git-commit

commit8fda87af2bb0625c502a23ddbd78a7447ada7bcb authorMichael Davis <mcarsondavis@gmail.com> dateThu 30 Dec 2021, 16:58 (5 years ago) parenta066f59
8 files changed+33−6
.gitmodules+4 book/src/generated/lang-support.md+1 helix-syntax/languages/tree-sitter-git-rebase+1 languages.toml+9 runtime/queries/git-commit/highlights.scm−1 runtime/queries/git-commit/injections.scm+3−5 runtime/queries/git-rebase/highlights.scm+11 runtime/queries/git-rebase/injections.scm+4
.gitmodules+4
@@ -178,3 +178,7 @@
178178 path = helix-syntax/languages/tree-sitter-git-diff
179179 url = https://github.com/the-mikedavis/tree-sitter-git-diff.git
180180 shallow = true
181+[submodule "helix-syntax/languages/tree-sitter-git-rebase"]
182+ path = helix-syntax/languages/tree-sitter-git-rebase
183+ url = https://github.com/the-mikedavis/tree-sitter-git-rebase.git
184+ shallow = true
book/src/generated/lang-support.md+1
@@ -13,6 +13,7 @@
1313| fish | ✓ | ✓ | ✓ | |
1414| git-commit | ✓ | | | |
1515| git-diff | ✓ | | | |
16+| git-rebase | ✓ | | | |
1617| glsl | ✓ | | ✓ | |
1718| go | ✓ | ✓ | ✓ | `gopls` |
1819| html | ✓ | | | |
helix-syntax/languages/tree-sitter-git-rebasenew file+1

Submodule changed.

languages.toml+9
@@ -490,3 +490,12 @@ file-types = ["diff"]
490490injection-regex = "diff"
491491comment-token = "#"
492492indent = { tab-width = 2, unit = " " }
493+
494+[[language]]
495+name = "git-rebase"
496+scope = "source.gitrebase"
497+roots = []
498+file-types = ["git-rebase-todo"]
499+injection-regex = "git-rebase"
500+comment-token = "#"
501+indent = { tab-width = 2, unit = " " }
runtime/queries/git-commit/highlights.scm−1
@@ -4,7 +4,6 @@
44(commit) @constant
55(item) @markup.link.url
66(header) @tag
7−(rebase_command) @markup.raw
87
98(change kind: "new file" @diff.plus)
109(change kind: "deleted" @diff.minus)
runtime/queries/git-commit/injections.scm+3−5
@@ -3,8 +3,6 @@
33 (#set! injection.include-children)
44 (#set! injection.language "diff"))
55
6−; once a rebase grammar is available, we can inject rebase highlighting into
7−; interactive rebase summary sections like so:
8−;
9−; ((rebase_command) @injection.content
10−; (#set! injection.language "git-rebase"))
6+((rebase_command) @injection.content
7+ (#set! injection.include-children)
8+ (#set! injection.language "git-rebase"))
runtime/queries/git-rebase/highlights.scmnew file+11
@@ -0,0 +1,11 @@
1+(operation operator: ["p" "pick" "r" "reword" "e" "edit" "s" "squash" "m" "merge" "d" "drop" "b" "break" "x" "exec"] @keyword)
2+(operation operator: ["l" "label" "t" "reset"] @function)
3+(operation operator: ["f" "fixup"] @function.special)
4+
5+(option) @operator
6+(label) @string.special.symbol
7+(commit) @constant
8+"#" @punctuation.delimiter
9+(comment) @comment
10+
11+(ERROR) @error
runtime/queries/git-rebase/injections.scmnew file+4
@@ -0,0 +1,4 @@
1+((operation
2+ operator: ["x" "exec"]
3+ (command) @injection.content)
4+ (#set! injection.language "bash"))