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
This commit is contained in:
Michael Davis 2021-12-30 16:58:47 -06:00 committed by GitHub
parent a066f59dc8
commit 8fda87af2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 33 additions and 6 deletions

4
.gitmodules vendored
View File

@ -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

View File

@ -13,6 +13,7 @@
| fish | ✓ | ✓ | ✓ | |
| git-commit | ✓ | | | |
| git-diff | ✓ | | | |
| git-rebase | ✓ | | | |
| glsl | ✓ | | ✓ | |
| go | ✓ | ✓ | ✓ | `gopls` |
| html | ✓ | | | |

@ -0,0 +1 @@
Subproject commit 332dc528f27044bc4427024dbb33e6941fc131f2

View File

@ -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 = " " }

View File

@ -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)

View File

@ -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"))

View File

@ -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

View File

@ -0,0 +1,4 @@
((operation
operator: ["x" "exec"]
(command) @injection.content)
(#set! injection.language "bash"))