mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-12 08:20:05 -04:00
feat: more @string.regex highlights
This commit is contained in:
parent
c4da794564
commit
92572c0dfd
3 changed files with 62 additions and 0 deletions
|
|
@ -247,3 +247,23 @@
|
||||||
(string) @string
|
(string) @string
|
||||||
|
|
||||||
(escape_sequence) @string.escape
|
(escape_sequence) @string.escape
|
||||||
|
|
||||||
|
; string.match("123", "%d+")
|
||||||
|
(function_call
|
||||||
|
(dot_index_expression
|
||||||
|
field: (identifier) @_method
|
||||||
|
(#any-of? @_method "find" "match" "gmatch" "gsub"))
|
||||||
|
arguments: (arguments
|
||||||
|
. (_)
|
||||||
|
.
|
||||||
|
(string
|
||||||
|
content: (string_content) @string.regex)))
|
||||||
|
|
||||||
|
;("123"):match("%d+")
|
||||||
|
(function_call
|
||||||
|
(method_index_expression
|
||||||
|
method: (identifier) @_method
|
||||||
|
(#any-of? @_method "find" "match" "gmatch" "gsub"))
|
||||||
|
arguments: (arguments
|
||||||
|
. (string
|
||||||
|
content: (string_content) @string.regex)))
|
||||||
|
|
|
||||||
|
|
@ -246,3 +246,29 @@
|
||||||
|
|
||||||
((comment) @comment.documentation
|
((comment) @comment.documentation
|
||||||
(#lua-match? @comment.documentation "^[-][-](%s?)@"))
|
(#lua-match? @comment.documentation "^[-][-](%s?)@"))
|
||||||
|
|
||||||
|
; string.match("123", "%d+")
|
||||||
|
(function_call
|
||||||
|
(dot_index_expression
|
||||||
|
field: (identifier) @_method
|
||||||
|
(#any-of? @_method "find" "format" "match"))
|
||||||
|
arguments: (arguments (_) . (string content: _ @string.regex)))
|
||||||
|
|
||||||
|
(function_call
|
||||||
|
(dot_index_expression
|
||||||
|
field: (identifier) @_method
|
||||||
|
(#any-of? @_method "gmatch" "gsub"))
|
||||||
|
arguments: (arguments (_) (string content: _ @string.regex)))
|
||||||
|
|
||||||
|
; ("123"):match("%d+")
|
||||||
|
(function_call
|
||||||
|
(method_index_expression
|
||||||
|
method: (identifier) @_method
|
||||||
|
(#any-of? @_method "find" "format" "match"))
|
||||||
|
arguments: (arguments . (string content: _ @string.regex)))
|
||||||
|
|
||||||
|
(function_call
|
||||||
|
(method_index_expression
|
||||||
|
method: (identifier) @_method
|
||||||
|
(#any-of? @_method "gmatch" "gsub"))
|
||||||
|
arguments: (arguments (string content: _ @string.regex)))
|
||||||
|
|
|
||||||
|
|
@ -32,3 +32,19 @@
|
||||||
|
|
||||||
((program . (comment)* . (comment) @preproc)
|
((program . (comment)* . (comment) @preproc)
|
||||||
(#lua-match? @preproc "^;+ *extends *$"))
|
(#lua-match? @preproc "^;+ *extends *$"))
|
||||||
|
|
||||||
|
((predicate
|
||||||
|
name: (identifier) @_name
|
||||||
|
parameters: (parameters (string "\"" @string "\"" @string) @string.regex))
|
||||||
|
(#any-of? @_name
|
||||||
|
"match"
|
||||||
|
"not-match"
|
||||||
|
"vim-match"
|
||||||
|
"not-vim-match"
|
||||||
|
"lua-match"
|
||||||
|
"not-lua-match"))
|
||||||
|
|
||||||
|
((predicate
|
||||||
|
name: (identifier) @_name
|
||||||
|
parameters: (parameters (string "\"" @string "\"" @string) @string.regex . (string) .))
|
||||||
|
(#any-of? @_name "gsub" "not-gsub"))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue