mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 20:00:07 -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
|
|
@ -26,5 +26,22 @@
|
|||
(#set! injection.language "c")
|
||||
)
|
||||
|
||||
; string.format('...')
|
||||
((function_call
|
||||
(index
|
||||
(identifier) @_base
|
||||
key: (identifier) @_entry)
|
||||
(arguments . (string) @injection.content))
|
||||
(#eq? @_base "string")
|
||||
(#eq? @_entry "format")
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
; ('...'):format()
|
||||
((function_call
|
||||
(method_index (string) @printf
|
||||
key: (identifier) @_func))
|
||||
(#eq? @_func "format")
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue