Skip to content

Commit

Permalink
feat: Add git rebase support (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 authored Oct 6, 2023
1 parent 8d0c039 commit 3b04466
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -436,3 +436,9 @@
branch = main
update = none
ignore = dirty
[submodule "repos/git-rebase"]
path = repos/git-rebase
url = https://github.com/the-mikedavis/tree-sitter-git-rebase
branch = main
update = none
ignore = dirty
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Unreleased
- Add `git rebase` support

## 0.12.58 - 2023-10-06
- Add `gitcommit` support
Expand Down
36 changes: 36 additions & 0 deletions queries/git-rebase/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
; 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)$"))

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

(comment) @comment
1 change: 1 addition & 0 deletions repos/git-rebase
Submodule git-rebase added at d8a420
1 change: 1 addition & 0 deletions tree-sitter-langs.el
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ See `tree-sitter-langs-repos'."
(fortran-mode . fortran)
(gdscript-mode . gdscript)
(git-commit-mode . gitcommit)
(git-rebase-mode . git-rebase)
(gitattributes-mode . gitattributes)
(gitignore-mode . gitignore)
(go-mode . go)
Expand Down

0 comments on commit 3b04466

Please sign in to comment.