From df6425287872c39e606522108c5364a9fdf3fcf8 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Fri, 24 Dec 2021 17:07:11 -0600 Subject: [PATCH 01/11] add submodule on tree-sitter-rebase, add to languages --- .gitmodules | 4 ++++ book/src/generated/lang-support.md | 1 + helix-syntax/languages/tree-sitter-rebase | 1 + languages.toml | 9 +++++++++ 4 files changed, 15 insertions(+) create mode 160000 helix-syntax/languages/tree-sitter-rebase diff --git a/.gitmodules b/.gitmodules index 422671b4e729..8b4b14bbb7d6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -178,3 +178,7 @@ path = helix-syntax/languages/tree-sitter-git-diff url = https://github.com/the-mikedavis/tree-sitter-git-diff.git shallow = true +[submodule "helix-syntax/languages/tree-sitter-rebase"] + path = helix-syntax/languages/tree-sitter-rebase + url = https://github.com/the-mikedavis/tree-sitter-rebase.git + shallow = true diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 91575c629ece..0378aec8a757 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -35,6 +35,7 @@ | protobuf | ✓ | | ✓ | | | python | ✓ | ✓ | ✓ | `pylsp` | | racket | | | | `racket` | +| rebase | ✓ | | | | | ruby | ✓ | | ✓ | `solargraph` | | rust | ✓ | ✓ | ✓ | `rust-analyzer` | | scala | ✓ | | ✓ | `metals` | diff --git a/helix-syntax/languages/tree-sitter-rebase b/helix-syntax/languages/tree-sitter-rebase new file mode 160000 index 000000000000..4b572504d808 --- /dev/null +++ b/helix-syntax/languages/tree-sitter-rebase @@ -0,0 +1 @@ +Subproject commit 4b572504d80832c3271dc1c9b351c756dbe75d37 diff --git a/languages.toml b/languages.toml index c3ae9f628308..a005ac9be876 100644 --- a/languages.toml +++ b/languages.toml @@ -490,3 +490,12 @@ file-types = ["diff"] injection-regex = "diff" comment-token = "#" indent = { tab-width = 2, unit = " " } + +[[language]] +name = "rebase" +scope = "git.rebase" +roots = [] +file-types = ["git-rebase-todo"] +injection-regex = "rebase" +comment-token = "#" +indent = { tab-width = 2, unit = " " } From a9a99f7da467c4e83ad517e154058cbd2fca0533 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Mon, 20 Dec 2021 23:07:22 -0600 Subject: [PATCH 02/11] add basic highlights query --- runtime/queries/rebase/highlights.scm | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 runtime/queries/rebase/highlights.scm diff --git a/runtime/queries/rebase/highlights.scm b/runtime/queries/rebase/highlights.scm new file mode 100644 index 000000000000..56ec4e38f5c2 --- /dev/null +++ b/runtime/queries/rebase/highlights.scm @@ -0,0 +1,9 @@ +(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) + +(option) @operator +(label) @string.special.symbol +(commit) @constant +"#" @punctuation.delimiter +(comment) @comment From 6e966547afbebea6beb0bcaac7709876ffbb53b3 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Mon, 20 Dec 2021 23:07:33 -0600 Subject: [PATCH 03/11] inject bash in execute statements --- runtime/queries/rebase/injections.scm | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 runtime/queries/rebase/injections.scm diff --git a/runtime/queries/rebase/injections.scm b/runtime/queries/rebase/injections.scm new file mode 100644 index 000000000000..070129b63d88 --- /dev/null +++ b/runtime/queries/rebase/injections.scm @@ -0,0 +1,4 @@ +((operation + operator: ["x" "exec"] + (command) @injection.content) + (#set! injection.language "bash")) From a405facdf873783b6de5c8568ed220ae6d924cd3 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Fri, 24 Dec 2021 18:02:49 -0600 Subject: [PATCH 04/11] update tree-sitter-rebase --- helix-syntax/languages/tree-sitter-rebase | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helix-syntax/languages/tree-sitter-rebase b/helix-syntax/languages/tree-sitter-rebase index 4b572504d808..332dc528f270 160000 --- a/helix-syntax/languages/tree-sitter-rebase +++ b/helix-syntax/languages/tree-sitter-rebase @@ -1 +1 @@ -Subproject commit 4b572504d80832c3271dc1c9b351c756dbe75d37 +Subproject commit 332dc528f27044bc4427024dbb33e6941fc131f2 From a9a96c1538bf4b5dc7e5d49467d19bed91fd2a0a Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Fri, 24 Dec 2021 18:08:56 -0600 Subject: [PATCH 05/11] tree-sitter-rebase->tree-sitter-git-rebase --- .gitmodules | 6 +++--- .../{tree-sitter-rebase => tree-sitter-git-rebase} | 0 languages.toml | 4 ++-- runtime/queries/{rebase => git-rebase}/highlights.scm | 0 runtime/queries/{rebase => git-rebase}/injections.scm | 0 5 files changed, 5 insertions(+), 5 deletions(-) rename helix-syntax/languages/{tree-sitter-rebase => tree-sitter-git-rebase} (100%) rename runtime/queries/{rebase => git-rebase}/highlights.scm (100%) rename runtime/queries/{rebase => git-rebase}/injections.scm (100%) diff --git a/.gitmodules b/.gitmodules index 8b4b14bbb7d6..22f70c802655 100644 --- a/.gitmodules +++ b/.gitmodules @@ -178,7 +178,7 @@ path = helix-syntax/languages/tree-sitter-git-diff url = https://github.com/the-mikedavis/tree-sitter-git-diff.git shallow = true -[submodule "helix-syntax/languages/tree-sitter-rebase"] - path = helix-syntax/languages/tree-sitter-rebase - url = https://github.com/the-mikedavis/tree-sitter-rebase.git +[submodule "helix-syntax/languages/tree-sitter-git-rebase"] + path = helix-syntax/languages/tree-sitter-git-rebase + url = https://github.com/the-mikedavis/tree-sitter-git-rebase.git shallow = true diff --git a/helix-syntax/languages/tree-sitter-rebase b/helix-syntax/languages/tree-sitter-git-rebase similarity index 100% rename from helix-syntax/languages/tree-sitter-rebase rename to helix-syntax/languages/tree-sitter-git-rebase diff --git a/languages.toml b/languages.toml index a005ac9be876..bcbc6ff7ff24 100644 --- a/languages.toml +++ b/languages.toml @@ -492,10 +492,10 @@ comment-token = "#" indent = { tab-width = 2, unit = " " } [[language]] -name = "rebase" +name = "git-rebase" scope = "git.rebase" roots = [] file-types = ["git-rebase-todo"] -injection-regex = "rebase" +injection-regex = "git-rebase" comment-token = "#" indent = { tab-width = 2, unit = " " } diff --git a/runtime/queries/rebase/highlights.scm b/runtime/queries/git-rebase/highlights.scm similarity index 100% rename from runtime/queries/rebase/highlights.scm rename to runtime/queries/git-rebase/highlights.scm diff --git a/runtime/queries/rebase/injections.scm b/runtime/queries/git-rebase/injections.scm similarity index 100% rename from runtime/queries/rebase/injections.scm rename to runtime/queries/git-rebase/injections.scm From 928168fbe28c0c9535cc43209d6cd5466075543a Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Wed, 29 Dec 2021 15:55:30 -0600 Subject: [PATCH 06/11] get injection working with tree-sitter-git-commit --- helix-syntax/languages/tree-sitter-git-commit | 2 +- runtime/queries/git-commit/highlights.scm | 1 - runtime/queries/git-commit/injections.scm | 8 +++----- runtime/queries/git-rebase/highlights.scm | 2 ++ 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/helix-syntax/languages/tree-sitter-git-commit b/helix-syntax/languages/tree-sitter-git-commit index 066e395e1107..8c9b15c2c000 160000 --- a/helix-syntax/languages/tree-sitter-git-commit +++ b/helix-syntax/languages/tree-sitter-git-commit @@ -1 +1 @@ -Subproject commit 066e395e1107df17183cf3ae4230f1a1406cc972 +Subproject commit 8c9b15c2c000fe7d6e0b2f007da4b6671a7139cf diff --git a/runtime/queries/git-commit/highlights.scm b/runtime/queries/git-commit/highlights.scm index ffcc31aef3e0..0b50d41908f5 100644 --- a/runtime/queries/git-commit/highlights.scm +++ b/runtime/queries/git-commit/highlights.scm @@ -4,7 +4,6 @@ (commit) @constant (item) @markup.link.url (header) @tag -(rebase_command) @markup.raw (change kind: "new file" @diff.plus) (change kind: "deleted" @diff.minus) diff --git a/runtime/queries/git-commit/injections.scm b/runtime/queries/git-commit/injections.scm index bd96f1de31d5..c9802f9d10f1 100644 --- a/runtime/queries/git-commit/injections.scm +++ b/runtime/queries/git-commit/injections.scm @@ -3,8 +3,6 @@ (#set! injection.include-children) (#set! injection.language "diff")) -; once a rebase grammar is available, we can inject rebase highlighting into -; interactive rebase summary sections like so: -; -; ((rebase_command) @injection.content -; (#set! injection.language "git-rebase")) +((rebasecommand) @injection.content + (#set! injection.include-children) + (#set! injection.language "git-rebase")) diff --git a/runtime/queries/git-rebase/highlights.scm b/runtime/queries/git-rebase/highlights.scm index 56ec4e38f5c2..4f007037d4b7 100644 --- a/runtime/queries/git-rebase/highlights.scm +++ b/runtime/queries/git-rebase/highlights.scm @@ -7,3 +7,5 @@ (commit) @constant "#" @punctuation.delimiter (comment) @comment + +(ERROR) @error From 060a558caf71208885ecd27b2b3e2dadfcb817b4 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Wed, 29 Dec 2021 15:58:57 -0600 Subject: [PATCH 07/11] set scope under source.gitrebase --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index bcbc6ff7ff24..3d9bac7b5f5b 100644 --- a/languages.toml +++ b/languages.toml @@ -493,7 +493,7 @@ indent = { tab-width = 2, unit = " " } [[language]] name = "git-rebase" -scope = "git.rebase" +scope = "source.gitrebase" roots = [] file-types = ["git-rebase-todo"] injection-regex = "git-rebase" From 2ecee155ea8e229651920b291062c2ee84b47944 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Wed, 29 Dec 2021 16:03:13 -0600 Subject: [PATCH 08/11] unset include-children on commit message injections --- runtime/queries/git-commit/injections.scm | 1 - 1 file changed, 1 deletion(-) diff --git a/runtime/queries/git-commit/injections.scm b/runtime/queries/git-commit/injections.scm index c9802f9d10f1..91e57860e5db 100644 --- a/runtime/queries/git-commit/injections.scm +++ b/runtime/queries/git-commit/injections.scm @@ -4,5 +4,4 @@ (#set! injection.language "diff")) ((rebasecommand) @injection.content - (#set! injection.include-children) (#set! injection.language "git-rebase")) From beff3dcc218b4fd23514a42a1ba18c22d38a8229 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Wed, 29 Dec 2021 16:09:22 -0600 Subject: [PATCH 09/11] Revert "unset include-children on commit message injections" This reverts commit 2ecee155ea8e229651920b291062c2ee84b47944. --- runtime/queries/git-commit/injections.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/queries/git-commit/injections.scm b/runtime/queries/git-commit/injections.scm index 91e57860e5db..c9802f9d10f1 100644 --- a/runtime/queries/git-commit/injections.scm +++ b/runtime/queries/git-commit/injections.scm @@ -4,4 +4,5 @@ (#set! injection.language "diff")) ((rebasecommand) @injection.content + (#set! injection.include-children) (#set! injection.language "git-rebase")) From d74d7590526925051b10a7c0b135f3dda058c863 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Wed, 29 Dec 2021 18:47:31 -0600 Subject: [PATCH 10/11] fix generated language docs --- book/src/generated/lang-support.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 0378aec8a757..09284d467b77 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -13,6 +13,7 @@ | fish | ✓ | ✓ | ✓ | | | git-commit | ✓ | | | | | git-diff | ✓ | | | | +| git-rebase | ✓ | | | | | glsl | ✓ | | ✓ | | | go | ✓ | ✓ | ✓ | `gopls` | | html | ✓ | | | | @@ -35,7 +36,6 @@ | protobuf | ✓ | | ✓ | | | python | ✓ | ✓ | ✓ | `pylsp` | | racket | | | | `racket` | -| rebase | ✓ | | | | | ruby | ✓ | | ✓ | `solargraph` | | rust | ✓ | ✓ | ✓ | `rust-analyzer` | | scala | ✓ | | ✓ | `metals` | From 051c9617f7f8a8c77ffde6a0c9a3234da210f897 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 30 Dec 2021 07:06:16 -0600 Subject: [PATCH 11/11] use rebase_command scopes from tree-sitter-git-commit --- helix-syntax/languages/tree-sitter-git-commit | 2 +- runtime/queries/git-commit/injections.scm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/helix-syntax/languages/tree-sitter-git-commit b/helix-syntax/languages/tree-sitter-git-commit index 8c9b15c2c000..066e395e1107 160000 --- a/helix-syntax/languages/tree-sitter-git-commit +++ b/helix-syntax/languages/tree-sitter-git-commit @@ -1 +1 @@ -Subproject commit 8c9b15c2c000fe7d6e0b2f007da4b6671a7139cf +Subproject commit 066e395e1107df17183cf3ae4230f1a1406cc972 diff --git a/runtime/queries/git-commit/injections.scm b/runtime/queries/git-commit/injections.scm index c9802f9d10f1..cf0657f725fa 100644 --- a/runtime/queries/git-commit/injections.scm +++ b/runtime/queries/git-commit/injections.scm @@ -3,6 +3,6 @@ (#set! injection.include-children) (#set! injection.language "diff")) -((rebasecommand) @injection.content +((rebase_command) @injection.content (#set! injection.include-children) (#set! injection.language "git-rebase"))