aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries
diff options
context:
space:
mode:
authorTomohiro Hashidate <kakyoin.hierophant@gmail.com>2025-11-15 00:04:54 +0900
committerGitHub <noreply@github.com>2025-11-14 07:04:54 -0800
commit2696fb832677fcd06588806d006aff923a4185a7 (patch)
tree2965d0a772d634266e4801ecbf6b61f1ef3c4236 /runtime/queries
parentfeat(zsh): bump parser, disallow injections for regex with expansion (diff)
downloadnvim-treesitter-2696fb832677fcd06588806d006aff923a4185a7.tar
nvim-treesitter-2696fb832677fcd06588806d006aff923a4185a7.tar.gz
nvim-treesitter-2696fb832677fcd06588806d006aff923a4185a7.tar.bz2
nvim-treesitter-2696fb832677fcd06588806d006aff923a4185a7.tar.lz
nvim-treesitter-2696fb832677fcd06588806d006aff923a4185a7.tar.xz
nvim-treesitter-2696fb832677fcd06588806d006aff923a4185a7.tar.zst
nvim-treesitter-2696fb832677fcd06588806d006aff923a4185a7.zip
feat(ruby): update queries to support rbs-inline syntax (#8282)
Diffstat (limited to 'runtime/queries')
-rw-r--r--runtime/queries/rbs/highlights.scm25
-rw-r--r--runtime/queries/ruby/injections.scm12
2 files changed, 37 insertions, 0 deletions
diff --git a/runtime/queries/rbs/highlights.scm b/runtime/queries/rbs/highlights.scm
index 9de9c427d..6c4b2434d 100644
--- a/runtime/queries/rbs/highlights.scm
+++ b/runtime/queries/rbs/highlights.scm
@@ -106,10 +106,18 @@
(global_name) @variable
+; Generics Keywords
+[
+ (generics_unchecked)
+ (generics_variance)
+] @keyword
+
; Standard Arguments
(parameter
(var_name) @variable.parameter)
+(unnamed_parameter) @variable.parameter
+
; Keyword Arguments
(keyword) @variable.parameter
@@ -144,6 +152,10 @@
"&"
"|"
"^"
+ "?"
+ (rest_operator)
+ (block_operator)
+ (optional_block_operator)
] @operator
; Punctuation
@@ -159,4 +171,17 @@
[
","
"."
+ ":"
] @punctuation.delimiter
+
+; RBS Inline syntax
+(inline_class_annotation) @keyword
+
+(inline_doc
+ (var_name) @variable.parameter)
+
+(inline_generic) @keyword
+
+(inline_override) @keyword
+
+(inline_skip) @keyword
diff --git a/runtime/queries/ruby/injections.scm b/runtime/queries/ruby/injections.scm
index e998e2bd7..2f75c846a 100644
--- a/runtime/queries/ruby/injections.scm
+++ b/runtime/queries/ruby/injections.scm
@@ -1,6 +1,18 @@
((comment) @injection.content
(#set! injection.language "comment"))
+((comment) @injection.content
+ (#lua-match? @injection.content "^#:")
+ (#set! injection.language "rbs"))
+
+((comment) @injection.content
+ (#lua-match? @injection.content "^#%s+@rbs")
+ (#set! injection.language "rbs"))
+
+((comment) @injection.content
+ (#lua-match? @injection.content "^#%s+|")
+ (#set! injection.language "rbs"))
+
(heredoc_body
(heredoc_content) @injection.content
(heredoc_end) @injection.language)