1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-12-23 17:31:13 +01:00

plugins/treesitter: support let expressions with injections

This commit is contained in:
Austin Horstman 2025-12-11 19:43:21 -06:00
parent 8486f9144e
commit a80557e142
2 changed files with 93 additions and 0 deletions

View file

@ -59,6 +59,13 @@
(string_expression (string_fragment) @injection.content)
(indented_string_expression (string_fragment) @injection.content)
])
; Let expressions
; extraConfigLua = let x = ...; in ''...''
(let_expression body: [
(string_expression (string_fragment) @injection.content)
(indented_string_expression (string_fragment) @injection.content)
])
]
(#any-of? @_path "__raw" "extraConfigLua" "extraConfigLuaPre" "extraConfigLuaPost")
(#set! injection.language "lua"))
@ -97,6 +104,13 @@
(string_expression (string_fragment) @injection.content)
(indented_string_expression (string_fragment) @injection.content)
])))))
; Let expressions
; luaConfig = { pre = let x = ...; in ''...'' }
(let_expression body: [
(string_expression (string_fragment) @injection.content)
(indented_string_expression (string_fragment) @injection.content)
])
]
(#any-of? @_nested "pre" "post" "content")
)))
@ -134,6 +148,13 @@
(string_expression (string_fragment) @injection.content)
(indented_string_expression (string_fragment) @injection.content)
])))))
; Let expressions
; luaConfig.pre = let x = ...; in ''...''
(let_expression body: [
(string_expression (string_fragment) @injection.content)
(indented_string_expression (string_fragment) @injection.content)
])
]
(#eq? @ns "luaConfig")
(#any-of? @name "pre" "post" "content")
@ -182,6 +203,13 @@
(indented_string_expression (string_fragment) @injection.content)
]))
]))
; Let expressions
; extraConfigVim = let x = ...; in ''...''
(let_expression body: [
(string_expression (string_fragment) @injection.content)
(indented_string_expression (string_fragment) @injection.content)
])
]
(#any-of? @_path "extraConfigVim" "extraConfigVimPre" "extraConfigVimPost")
(#set! injection.language "vim"))