Skip to content

Commit 3b04466

Browse files
authored
feat: Add git rebase support (#262)
1 parent 8d0c039 commit 3b04466

File tree

5 files changed

+45
-0
lines changed

5 files changed

+45
-0
lines changed

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,3 +436,9 @@
436436
branch = main
437437
update = none
438438
ignore = dirty
439+
[submodule "repos/git-rebase"]
440+
path = repos/git-rebase
441+
url = https://github.com/the-mikedavis/tree-sitter-git-rebase
442+
branch = main
443+
update = none
444+
ignore = dirty

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Changelog
22

33
## Unreleased
4+
- Add `git rebase` support
45

56
## 0.12.58 - 2023-10-06
67
- Add `gitcommit` support

queries/git-rebase/highlights.scm

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
; a rough translation:
2+
; * constant.builtin - git hash
3+
; * constant - a git label
4+
; * keyword - command that acts on commits commits
5+
; * function - command that acts only on labels
6+
; * comment - discarded commentary on a command, has no effect on the rebase
7+
; * string - text used in the rebase operation
8+
; * operator - a 'switch' (used in fixup and merge), either -c or -C at time of writing
9+
10+
(((command) @keyword
11+
(label) @constant.builtin
12+
(message)? @comment)
13+
(#match? @keyword "^(p|pick|r|reword|e|edit|s|squash|d|drop)$"))
14+
15+
(((command) @function
16+
(label) @constant
17+
(message)? @comment)
18+
(#match? @function "^(l|label|t|reset)$"))
19+
20+
((command) @keyword
21+
(#match? @keyword "^(x|exec|b|break)$"))
22+
23+
(((command) @attribute
24+
(label) @constant.builtin
25+
(message)? @comment)
26+
(#match? @attribute "^(f|fixup)$"))
27+
28+
(((command) @keyword
29+
(label) @constant.builtin
30+
(label) @constant
31+
(message) @string)
32+
(#match? @keyword "^(m|merge)$"))
33+
34+
(option) @operator
35+
36+
(comment) @comment

repos/git-rebase

Submodule git-rebase added at d8a4207

tree-sitter-langs.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ See `tree-sitter-langs-repos'."
127127
(fortran-mode . fortran)
128128
(gdscript-mode . gdscript)
129129
(git-commit-mode . gitcommit)
130+
(git-rebase-mode . git-rebase)
130131
(gitattributes-mode . gitattributes)
131132
(gitignore-mode . gitignore)
132133
(go-mode . go)

0 commit comments

Comments
 (0)