Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tree-sitter-git-rebase #1402

Merged
merged 11 commits into from
Dec 30, 2021
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
| fish |||| |
| git-commit || | | |
| git-diff || | | |
| git-rebase || | | |
| glsl || || |
| go |||| `gopls` |
| html || | | |
Expand Down
1 change: 1 addition & 0 deletions helix-syntax/languages/tree-sitter-git-rebase
Submodule tree-sitter-git-rebase added at 332dc5
9 changes: 9 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = " " }
1 change: 0 additions & 1 deletion runtime/queries/git-commit/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 3 additions & 5 deletions runtime/queries/git-commit/injections.scm
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
11 changes: 11 additions & 0 deletions runtime/queries/git-rebase/highlights.scm
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions runtime/queries/git-rebase/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
((operation
operator: ["x" "exec"]
(command) @injection.content)
(#set! injection.language "bash"))