From 54d24875869b2beb06c63b542d8cc33a1066198c Mon Sep 17 00:00:00 2001 From: Skyler Hawthorne Date: Fri, 17 Feb 2023 10:41:37 -0500 Subject: [PATCH 1/2] update git-rebase --- runtime/queries/git-rebase/highlights.scm | 41 ++++++++++++++++++----- 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 4f007037d4b7..140670bd606a 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)$")) + +((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 070129b63d88..90f1f94163a5 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") +) From d031b0236b5e496ff48f14f0ae8d35dcb4147a24 Mon Sep 17 00:00:00 2001 From: Skyler Hawthorne Date: Fri, 17 Feb 2023 11:02:32 -0500 Subject: [PATCH 2/2] git-rebase: Add update-ref --- runtime/queries/git-rebase/highlights.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/queries/git-rebase/highlights.scm b/runtime/queries/git-rebase/highlights.scm index 140670bd606a..5a03dadf87ab 100644 --- a/runtime/queries/git-rebase/highlights.scm +++ b/runtime/queries/git-rebase/highlights.scm @@ -15,7 +15,7 @@ (((command) @function (label) @constant (message)? @comment) - (#match? @function "^(l|label|t|reset)$")) + (#match? @function "^(l|label|t|reset|u|update-ref)$")) ((command) @keyword (#match? @keyword "^(x|exec|b|break)$"))