Add tree-sitter-comment (#1300)

* Add tree-sitter-comment

Fix #1164

* fix precedence in tree-sitter-comment highlights

connects https://github.com/helix-editor/helix/pull/1170

* set injection-regex for comment language

* remove comment filetype

* fix comment injections for neovim-style injections tags

* add comment injections for elixir

* remove f.comment

* fix spacing in .gitmodules

* run 'cargo xtask docgen'

Co-authored-by: Ivan Tham <pickfire@riseup.net>
pull/1309/head
Michael Davis 3 years ago committed by GitHub
parent 7c01d92653
commit e72786df8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

4
.gitmodules vendored

@ -142,6 +142,10 @@
path = helix-syntax/languages/tree-sitter-perl path = helix-syntax/languages/tree-sitter-perl
url = https://github.com/ganezdragon/tree-sitter-perl url = https://github.com/ganezdragon/tree-sitter-perl
shallow = true shallow = true
[submodule "helix-syntax/languages/tree-sitter-comment"]
path = helix-syntax/languages/tree-sitter-comment
url = https://github.com/stsewd/tree-sitter-comment
shallow = true
[submodule "helix-syntax/languages/tree-sitter-wgsl"] [submodule "helix-syntax/languages/tree-sitter-wgsl"]
path = helix-syntax/languages/tree-sitter-wgsl path = helix-syntax/languages/tree-sitter-wgsl
url = https://github.com/szebniok/tree-sitter-wgsl url = https://github.com/szebniok/tree-sitter-wgsl

@ -4,6 +4,7 @@
| c | ✓ | | | `clangd` | | c | ✓ | | | `clangd` |
| c-sharp | ✓ | | | | | c-sharp | ✓ | | | |
| cmake | ✓ | | | `cmake-language-server` | | cmake | ✓ | | | `cmake-language-server` |
| comment | ✓ | | | |
| cpp | ✓ | | | `clangd` | | cpp | ✓ | | | `clangd` |
| css | ✓ | | | | | css | ✓ | | | |
| dart | ✓ | | ✓ | `dart` | | dart | ✓ | | ✓ | `dart` |

@ -0,0 +1 @@
Subproject commit 5dd3c62f1bbe378b220fe16b317b85247898639e

@ -406,6 +406,13 @@ shebangs = ["racket"]
comment-token = ";" comment-token = ";"
language-server = { command = "racket", args = ["-l", "racket-langserver"] } language-server = { command = "racket", args = ["-l", "racket-langserver"] }
[[language]]
name = "comment"
scope = "scope.comment"
roots = []
file-types = []
injection-regex = "comment"
[[language]] [[language]]
name = "wgsl" name = "wgsl"
scope = "source.wgsl" scope = "source.wgsl"

@ -0,0 +1,30 @@
[
"("
")"
] @punctuation.bracket
":" @punctuation.delimiter
((tag (name) @warning)
(#match? @warning "^(TODO|HACK|WARNING)$"))
("text" @warning
(#match? @warning "^(TODO|HACK|WARNING)$"))
((tag (name) @error)
(match? @error "^(FIXME|XXX|BUG)$"))
("text" @error
(match? @error "^(FIXME|XXX|BUG)$"))
(tag
(name) @ui.text
(user)? @constant)
; Issue number (#123)
("text" @constant.numeric
(#match? @constant.numeric "^#[0-9]+$"))
; User mention (@user)
("text" @tag
(#match? @tag "^[@][a-zA-Z0-9_-]+$"))

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

@ -1,3 +1,5 @@
(preproc_arg) @glsl ((preproc_arg) @injection.content
(#set! injection.language "glsl"))
(comment) @comment ((comment) @injection.content
(#set! injection.language "comment"))

@ -1,5 +1,7 @@
; TODO: re-add when markdown is added. ; TODO: re-add when markdown is added.
; ((triple_string) @markdown ; ((triple_string) @injection.content
; (#offset! @markdown 0 3 0 -3)) ; (#offset! @injection.content 0 3 0 -3)
; (#set! injection.language "markdown"))
(comment) @comment ((comment) @injection.content
(#set! injection.language "comment"))

@ -1,2 +1,2 @@
(comment) @comment ([(comment) (note)] @injection.content
(note) @comment (#set! injection.language "comment"))

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

@ -1,3 +1,6 @@
([(line_comment) (block_comment)] @injection.content
(#set! injection.language "comment"))
((macro_invocation ((macro_invocation
(token_tree) @injection.content) (token_tree) @injection.content)
(#set! injection.language "rust") (#set! injection.language "rust")

@ -26,5 +26,5 @@
(#set! injection.language "typescript") (#set! injection.language "typescript")
) )
(comment) @comment ((comment) @injection.content
(#set! injection.language "comment"))

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))
Loading…
Cancel
Save