1
0
mirror of https://github.com/helix-editor/helix synced 2026-03-12 10:48:32 +01:00
helix/runtime/queries/lua/injections.scm
2026-01-18 12:35:23 -06:00

53 lines
1.4 KiB
Scheme

((comment) @injection.content
(#set! injection.language "comment")
(#set! injection.include-children))
; 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) @injection.content
(#set! injection.language "luap")
(#set! injection.include-children))))
; ("123"):match("%d+")
(function_call
(method_index_expression
method: (identifier) @_method
(#any-of? @_method "find" "match" "gmatch" "gsub"))
arguments: (arguments
.
(string
content: (string_content) @injection.content
(#set! injection.language "luap")
(#set! injection.include-children))))
; string.format("format string", ...)
((function_call
name: (dot_index_expression
table: (identifier) @_table
field: (identifier) @_function)
arguments: (arguments
.
(string
content: (string_content) @injection.content)))
(#eq? @_table "string")
(#eq? @_function "format")
(#set! injection.language "lua-format-string"))
; ("format"):format(...)
((function_call
name: (method_index_expression
table: (parenthesized_expression
(string
content: (string_content) @injection.content))
method: (identifier) @_function))
(#eq? @_function "format")
(#set! injection.language "lua-format-string"))