on master help sign in
Add tree-sitter-git-diff (#1373)
bcf3808Michael Davis
.gitmodules+4
@@ -174,3 +174,7 @@
174 path = helix-syntax/languages/tree-sitter-git-commit
174 path = helix-syntax/languages/tree-sitter-git-commit
175 url = https://github.com/the-mikedavis/tree-sitter-git-commit.git
175 url = https://github.com/the-mikedavis/tree-sitter-git-commit.git
176 shallow = true
176 shallow = true
177+[submodule "helix-syntax/languages/tree-sitter-git-diff"]
178+ path = helix-syntax/languages/tree-sitter-git-diff
179+ url = https://github.com/the-mikedavis/tree-sitter-git-diff.git
180+ shallow = true
book/src/generated/lang-support.md+1
@@ -12,6 +12,7 @@
12| elixir | ✓ | | | `elixir-ls` |
12| elixir | ✓ | | | `elixir-ls` |
13| fish | ✓ | ✓ | ✓ | |
13| fish | ✓ | ✓ | ✓ | |
14| git-commit | ✓ | | | |
14| git-commit | ✓ | | | |
15+| git-diff | ✓ | | | |
15| glsl | ✓ | | ✓ | |
16| glsl | ✓ | | ✓ | |
16| go | ✓ | ✓ | ✓ | `gopls` |
17| go | ✓ | ✓ | ✓ | `gopls` |
17| html | ✓ | | | |
18| html | ✓ | | | |
helix-syntax/languages/tree-sitter-git-commit+1−1

Submodule changed.

helix-syntax/languages/tree-sitter-git-diffnew file+1

Submodule changed.

languages.toml+9
@@ -481,3 +481,12 @@ roots = []
481file-types = ["COMMIT_EDITMSG"]
481file-types = ["COMMIT_EDITMSG"]
482comment-token = "#"
482comment-token = "#"
483indent = { tab-width = 2, unit = " " }
483indent = { tab-width = 2, unit = " " }
484+
485+[[language]]
486+name = "git-diff"
487+scope = "source.diff"
488+roots = []
489+file-types = ["diff"]
490+injection-regex = "diff"
491+comment-token = "#"
492+indent = { tab-width = 2, unit = " " }
runtime/queries/git-commit/highlights.scm−4
@@ -13,7 +13,3 @@
13
13
14[":" "->"] @punctuation.delimeter
14[":" "->"] @punctuation.delimeter
15(comment) @comment
15(comment) @comment
16−
17−; once we have diff injections, @comment should become @none
18−((comment (scissors))
19− (message)+ @comment)
runtime/queries/git-commit/injections.scm+4−9
@@ -1,12 +1,7 @@
1−; once a diff grammar is available, we can inject diff highlighting into the
2−; trailer after scissors (git commit --verbose)
3−; see https://github.com/helix-editor/helix/pull/1338#issuecomment-1000013539
4−;
5−; ((comment (scissors))
1+((comment (scissors))
6−; (message) @injection.content
2+ (message) @injection.content
3+ (#set! injection.include-children)
7−; (#set! injection.language "diff"))
4+ (#set! injection.language "diff"))
8−
9−; ---
10
5
11; once a rebase grammar is available, we can inject rebase highlighting into
6; once a rebase grammar is available, we can inject rebase highlighting into
12; interactive rebase summary sections like so:
7; interactive rebase summary sections like so:
runtime/queries/git-diff/highlights.scmnew file+6
@@ -0,0 +1,6 @@
1+[(addition) (new_file)] @diff.plus
2+[(deletion) (old_file)] @diff.minus
3+
4+(commit) @constant
5+(location) @attribute
6+(command) @markup.bold