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 5b90ea2aba
commit 17fae3f4a3
13 changed files with 181 additions and 0 deletions

View file

@ -135,6 +135,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
content: (_) @injection.content
(#set! injection.language "comment"))