Skip to content

Commit

Permalink
Update tree-sitter-git-rebase (helix-editor#6030)
Browse files Browse the repository at this point in the history
  • Loading branch information
dead10ck authored and wes-adams committed Jul 3, 2023
1 parent 6b5d9ef commit 404b1d8
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 12 deletions.
41 changes: 33 additions & 8 deletions runtime/queries/git-rebase/highlights.scm
Original file line number Diff line number Diff line change
@@ -1,11 +1,36 @@
(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)
; a rough translation:
; * constant.builtin - git hash
; * constant - a git label
; * keyword - command that acts on commits commits
; * function - command that acts only on labels
; * comment - discarded commentary on a command, has no effect on the rebase
; * string - text used in the rebase operation
; * operator - a 'switch' (used in fixup and merge), either -c or -C at time of writing

(((command) @keyword
(label) @constant.builtin
(message)? @comment)
(#match? @keyword "^(p|pick|r|reword|e|edit|s|squash|d|drop)$"))

(((command) @function
(label) @constant
(message)? @comment)
(#match? @function "^(l|label|t|reset|u|update-ref)$"))

((command) @keyword
(#match? @keyword "^(x|exec|b|break)$"))

(((command) @attribute
(label) @constant.builtin
(message)? @comment)
(#match? @attribute "^(f|fixup)$"))

(((command) @keyword
(label) @constant.builtin
(label) @constant
(message) @string)
(#match? @keyword "^(m|merge)$"))

(option) @operator
(label) @string.special.symbol
(commit) @constant
"#" @punctuation.delimiter
(comment) @comment

(ERROR) @error
(comment) @comment
9 changes: 5 additions & 4 deletions runtime/queries/git-rebase/injections.scm
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
((operation
operator: ["x" "exec"]
(command) @injection.content)
(#set! injection.language "bash"))
(((command) @attribute
(message)? @injection.content)
(#match? @attribute "^(x|exec)$")
(#set! injection.language "bash")
)

0 comments on commit 404b1d8

Please sign in to comment.