mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-12 08:20:05 -04:00
feat(injections): add printf format strings
This commit is contained in:
parent
5b90ea2aba
commit
17fae3f4a3
13 changed files with 181 additions and 0 deletions
|
|
@ -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"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue