feat(injections): add printf format strings

This commit is contained in:
ObserverOfTime 2023-08-19 19:28:45 +03:00 committed by Christian Clason
parent 2160b26453
commit 947c43052c
14 changed files with 184 additions and 20 deletions

View file

@ -87,6 +87,23 @@
(#set! injection.language "luap")
(#set! injection.include-children))))
; string.format("pi = %.2f", 3.14159)
((function_call
(dot_index_expression
field: (identifier) @_method)
arguments: (arguments
. (string (string_content) @injection.content)))
(#eq? @_method "format")
(#set! injection.language "printf"))
; ("pi = %.2f"):format(3.14159)
((function_call
(method_index_expression
table: (_ (string (string_content) @injection.content))
method: (identifier) @_method))
(#eq? @_method "format")
(#set! injection.language "printf"))
((comment) @injection.content
(#set! injection.language "comment")
(#set! injection.include-children))