mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-02 19:46:58 -04:00
feat(injections): add printf format strings
This commit is contained in:
parent
2160b26453
commit
947c43052c
14 changed files with 184 additions and 20 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue