mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-15 01:40:02 -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
|
|
@ -8,3 +8,28 @@
|
|||
(heredoc_body) @injection.content
|
||||
(heredoc_end) @injection.language)
|
||||
(#downcase! @injection.language))
|
||||
|
||||
; printf 'format'
|
||||
((command
|
||||
name: (command_name) @_command
|
||||
. argument: [(string) (raw_string)] @injection.content)
|
||||
(#eq? @_command "printf")
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
; printf -v var 'format'
|
||||
((command
|
||||
name: (command_name) @_command
|
||||
argument: (word) @_arg
|
||||
. (_) . argument: [(string) (raw_string)] @injection.content)
|
||||
(#eq? @_command "printf")
|
||||
(#eq? @_arg "-v")
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
; printf -- 'format'
|
||||
((command
|
||||
name: (command_name) @_command
|
||||
argument: (word) @_arg
|
||||
. argument: [(string) (raw_string)] @injection.content)
|
||||
(#eq? @_command "printf")
|
||||
(#eq? @_arg "--")
|
||||
(#set! injection.language "printf"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue