diff options
author | Skyler Hawthorne | 2023-02-19 17:34:47 +0000 |
---|---|---|
committer | GitHub | 2023-02-19 17:34:47 +0000 |
commit | 71220da1392e373f1f7dc6370def9cd3c5c41ff9 (patch) | |
tree | 61593b095a0b6ba14d5c19a7955c19da671a9307 | |
parent | c5c1b5af34fb3f217fce4bec5f7bb16369e59888 (diff) |
Update tree-sitter-git-rebase (#6030)
-rw-r--r-- | runtime/queries/git-rebase/highlights.scm | 41 | ||||
-rw-r--r-- | runtime/queries/git-rebase/injections.scm | 9 |
2 files changed, 38 insertions, 12 deletions
diff --git a/runtime/queries/git-rebase/highlights.scm b/runtime/queries/git-rebase/highlights.scm index 4f007037..5a03dadf 100644 --- a/runtime/queries/git-rebase/highlights.scm +++ b/runtime/queries/git-rebase/highlights.scm @@ -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 diff --git a/runtime/queries/git-rebase/injections.scm b/runtime/queries/git-rebase/injections.scm index 070129b6..90f1f941 100644 --- a/runtime/queries/git-rebase/injections.scm +++ b/runtime/queries/git-rebase/injections.scm @@ -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") +) |