aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules4
-rw-r--r--book/src/generated/lang-support.md1
m---------helix-syntax/languages/tree-sitter-comment0
-rw-r--r--languages.toml9
-rw-r--r--runtime/queries/comment/highlights.scm30
-rw-r--r--runtime/queries/elixir/injections.scm2
-rw-r--r--runtime/queries/glsl/injections.scm6
-rw-r--r--runtime/queries/julia/injections.scm8
-rw-r--r--runtime/queries/ledger/injections.scm4
-rw-r--r--runtime/queries/python/injections.scm2
-rw-r--r--runtime/queries/rust/injections.scm3
-rw-r--r--runtime/queries/svelte/injections.scm4
-rw-r--r--runtime/queries/tsq/injections.scm2
13 files changed, 65 insertions, 10 deletions
diff --git a/.gitmodules b/.gitmodules
index a899c778..c7b81336 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -142,6 +142,10 @@
path = helix-syntax/languages/tree-sitter-perl
url = https://github.com/ganezdragon/tree-sitter-perl
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"]
path = helix-syntax/languages/tree-sitter-wgsl
url = https://github.com/szebniok/tree-sitter-wgsl
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index 3255b9af..cb91872b 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -4,6 +4,7 @@
| c | ✓ | | | `clangd` |
| c-sharp | ✓ | | | |
| cmake | ✓ | | | `cmake-language-server` |
+| comment | ✓ | | | |
| cpp | ✓ | | | `clangd` |
| css | ✓ | | | |
| dart | ✓ | | ✓ | `dart` |
diff --git a/helix-syntax/languages/tree-sitter-comment b/helix-syntax/languages/tree-sitter-comment
new file mode 160000
+Subproject 5dd3c62f1bbe378b220fe16b317b85247898639
diff --git a/languages.toml b/languages.toml
index 5c2bc8bb..0695022e 100644
--- a/languages.toml
+++ b/languages.toml
@@ -407,6 +407,13 @@ comment-token = ";"
language-server = { command = "racket", args = ["-l", "racket-langserver"] }
[[language]]
+name = "comment"
+scope = "scope.comment"
+roots = []
+file-types = []
+injection-regex = "comment"
+
+[[language]]
name = "wgsl"
scope = "source.wgsl"
file-types = ["wgsl"]
@@ -448,4 +455,4 @@ roots = ["build.sbt"]
file-types = ["scala", "sbt"]
comment-token = "//"
indent = { tab-width = 2, unit = " " }
-language-server = { command = "metals" } \ No newline at end of file
+language-server = { command = "metals" }
diff --git a/runtime/queries/comment/highlights.scm b/runtime/queries/comment/highlights.scm
new file mode 100644
index 00000000..88685d59
--- /dev/null
+++ b/runtime/queries/comment/highlights.scm
@@ -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_-]+$"))
diff --git a/runtime/queries/elixir/injections.scm b/runtime/queries/elixir/injections.scm
new file mode 100644
index 00000000..321c90ad
--- /dev/null
+++ b/runtime/queries/elixir/injections.scm
@@ -0,0 +1,2 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))
diff --git a/runtime/queries/glsl/injections.scm b/runtime/queries/glsl/injections.scm
index 7d3323b1..b01b8b4b 100644
--- a/runtime/queries/glsl/injections.scm
+++ b/runtime/queries/glsl/injections.scm
@@ -1,3 +1,5 @@
-(preproc_arg) @glsl
+((preproc_arg) @injection.content
+ (#set! injection.language "glsl"))
-(comment) @comment
+((comment) @injection.content
+ (#set! injection.language "comment"))
diff --git a/runtime/queries/julia/injections.scm b/runtime/queries/julia/injections.scm
index be2412c0..3cf7339f 100644
--- a/runtime/queries/julia/injections.scm
+++ b/runtime/queries/julia/injections.scm
@@ -1,5 +1,7 @@
; TODO: re-add when markdown is added.
-; ((triple_string) @markdown
-; (#offset! @markdown 0 3 0 -3))
+; ((triple_string) @injection.content
+; (#offset! @injection.content 0 3 0 -3)
+; (#set! injection.language "markdown"))
-(comment) @comment
+((comment) @injection.content
+ (#set! injection.language "comment"))
diff --git a/runtime/queries/ledger/injections.scm b/runtime/queries/ledger/injections.scm
index 2d948141..c1714786 100644
--- a/runtime/queries/ledger/injections.scm
+++ b/runtime/queries/ledger/injections.scm
@@ -1,2 +1,2 @@
-(comment) @comment
-(note) @comment
+([(comment) (note)] @injection.content
+ (#set! injection.language "comment"))
diff --git a/runtime/queries/python/injections.scm b/runtime/queries/python/injections.scm
new file mode 100644
index 00000000..321c90ad
--- /dev/null
+++ b/runtime/queries/python/injections.scm
@@ -0,0 +1,2 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))
diff --git a/runtime/queries/rust/injections.scm b/runtime/queries/rust/injections.scm
index 6035d418..d8382e49 100644
--- a/runtime/queries/rust/injections.scm
+++ b/runtime/queries/rust/injections.scm
@@ -1,3 +1,6 @@
+([(line_comment) (block_comment)] @injection.content
+ (#set! injection.language "comment"))
+
((macro_invocation
(token_tree) @injection.content)
(#set! injection.language "rust")
diff --git a/runtime/queries/svelte/injections.scm b/runtime/queries/svelte/injections.scm
index 266f4701..04e860cf 100644
--- a/runtime/queries/svelte/injections.scm
+++ b/runtime/queries/svelte/injections.scm
@@ -26,5 +26,5 @@
(#set! injection.language "typescript")
)
-(comment) @comment
-
+((comment) @injection.content
+ (#set! injection.language "comment"))
diff --git a/runtime/queries/tsq/injections.scm b/runtime/queries/tsq/injections.scm
new file mode 100644
index 00000000..321c90ad
--- /dev/null
+++ b/runtime/queries/tsq/injections.scm
@@ -0,0 +1,2 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))