on master help sign in
Add tree-sitter-comment (#1300)
e72786dMichael Davis
.gitmodules+4
@@ -142,6 +142,10 @@
142 path = helix-syntax/languages/tree-sitter-perl
142 path = helix-syntax/languages/tree-sitter-perl
143 url = https://github.com/ganezdragon/tree-sitter-perl
143 url = https://github.com/ganezdragon/tree-sitter-perl
144 shallow = true
144 shallow = true
145+[submodule "helix-syntax/languages/tree-sitter-comment"]
146+ path = helix-syntax/languages/tree-sitter-comment
147+ url = https://github.com/stsewd/tree-sitter-comment
148+ shallow = true
145[submodule "helix-syntax/languages/tree-sitter-wgsl"]
149[submodule "helix-syntax/languages/tree-sitter-wgsl"]
146 path = helix-syntax/languages/tree-sitter-wgsl
150 path = helix-syntax/languages/tree-sitter-wgsl
147 url = https://github.com/szebniok/tree-sitter-wgsl
151 url = https://github.com/szebniok/tree-sitter-wgsl
book/src/generated/lang-support.md+1
@@ -4,6 +4,7 @@
4| c | ✓ | | | `clangd` |
4| c | ✓ | | | `clangd` |
5| c-sharp | ✓ | | | |
5| c-sharp | ✓ | | | |
6| cmake | ✓ | | | `cmake-language-server` |
6| cmake | ✓ | | | `cmake-language-server` |
7+| comment | ✓ | | | |
7| cpp | ✓ | | | `clangd` |
8| cpp | ✓ | | | `clangd` |
8| css | ✓ | | | |
9| css | ✓ | | | |
9| dart | ✓ | | ✓ | `dart` |
10| dart | ✓ | | ✓ | `dart` |
helix-syntax/languages/tree-sitter-commentnew file+1

Submodule changed.

languages.toml+8−1
@@ -406,6 +406,13 @@ shebangs = ["racket"]
406comment-token = ";"
406comment-token = ";"
407language-server = { command = "racket", args = ["-l", "racket-langserver"] }
407language-server = { command = "racket", args = ["-l", "racket-langserver"] }
408
408
409+[[language]]
410+name = "comment"
411+scope = "scope.comment"
412+roots = []
413+file-types = []
414+injection-regex = "comment"
415+
409[[language]]
416[[language]]
410name = "wgsl"
417name = "wgsl"
411scope = "source.wgsl"
418scope = "source.wgsl"
@@ -448,4 +455,4 @@ roots = ["build.sbt"]
448file-types = ["scala", "sbt"]
455file-types = ["scala", "sbt"]
449comment-token = "//"
456comment-token = "//"
450indent = { tab-width = 2, unit = " " }
457indent = { tab-width = 2, unit = " " }
451−language-server = { command = "metals" }
458+language-server = { command = "metals" }
runtime/queries/comment/highlights.scmnew file+30
@@ -0,0 +1,30 @@
1+[
2+ "("
3+ ")"
4+] @punctuation.bracket
5+
6+":" @punctuation.delimiter
7+
8+((tag (name) @warning)
9+ (#match? @warning "^(TODO|HACK|WARNING)$"))
10+
11+("text" @warning
12+ (#match? @warning "^(TODO|HACK|WARNING)$"))
13+
14+((tag (name) @error)
15+ (match? @error "^(FIXME|XXX|BUG)$"))
16+
17+("text" @error
18+ (match? @error "^(FIXME|XXX|BUG)$"))
19+
20+(tag
21+ (name) @ui.text
22+ (user)? @constant)
23+
24+; Issue number (#123)
25+("text" @constant.numeric
26+ (#match? @constant.numeric "^#[0-9]+$"))
27+
28+; User mention (@user)
29+("text" @tag
30+ (#match? @tag "^[@][a-zA-Z0-9_-]+$"))
runtime/queries/elixir/injections.scmnew file+2
@@ -0,0 +1,2 @@
1+((comment) @injection.content
2+ (#set! injection.language "comment"))
runtime/queries/glsl/injections.scm+4−2
@@ -1,3 +1,5 @@
1−(preproc_arg) @glsl
1+((preproc_arg) @injection.content
2+ (#set! injection.language "glsl"))
2
3
3−(comment) @comment
4+((comment) @injection.content
5+ (#set! injection.language "comment"))
runtime/queries/julia/injections.scm+5−3
@@ -1,5 +1,7 @@
1; TODO: re-add when markdown is added.
1; TODO: re-add when markdown is added.
2−; ((triple_string) @markdown
2+; ((triple_string) @injection.content
3−; (#offset! @markdown 0 3 0 -3))
3+; (#offset! @injection.content 0 3 0 -3)
4+; (#set! injection.language "markdown"))
4
5
5−(comment) @comment
6+((comment) @injection.content
7+ (#set! injection.language "comment"))
runtime/queries/ledger/injections.scm+2−2
@@ -1,2 +1,2 @@
1−(comment) @comment
1+([(comment) (note)] @injection.content
2−(note) @comment
2+ (#set! injection.language "comment"))
runtime/queries/python/injections.scmnew file+2
@@ -0,0 +1,2 @@
1+((comment) @injection.content
2+ (#set! injection.language "comment"))
runtime/queries/rust/injections.scm+3
@@ -1,3 +1,6 @@
1+([(line_comment) (block_comment)] @injection.content
2+ (#set! injection.language "comment"))
3+
1((macro_invocation
4((macro_invocation
2 (token_tree) @injection.content)
5 (token_tree) @injection.content)
3 (#set! injection.language "rust")
6 (#set! injection.language "rust")
runtime/queries/svelte/injections.scm+2−2
@@ -26,5 +26,5 @@
26 (#set! injection.language "typescript")
26 (#set! injection.language "typescript")
27)
27)
28
28
29−(comment) @comment
29+((comment) @injection.content
30−
30+ (#set! injection.language "comment"))
runtime/queries/tsq/injections.scmnew file+2
@@ -0,0 +1,2 @@
1+((comment) @injection.content
2+ (#set! injection.language "comment"))