injections(lua): highlight Lua code in vim.rpcrequest and vim.rpcnotify

This commit is contained in:
smjonas 2023-04-24 13:25:00 +02:00 committed by Amaan Qureshi
parent 77ffc7edbe
commit 72e2e2df86

View file

@ -16,7 +16,14 @@
arguments: (arguments (string content: _ @query) .))
(#any-of? @_vimcmd_identifier "vim.treesitter.query.set" "vim.treesitter.query.parse_query" "vim.treesitter.query.parse"))
;; highlight string as query if starts with `;; query`
; vim.rcprequest(123, "nvim_exec_lua", "return vim.api.nvim_buf_get_lines(0, 0, -1, false)", false)
((function_call
name: (_) @_vimcmd_identifier
arguments: (arguments . (_) . (string) @_method . (string content: _ @lua)))
(#any-of? @_vimcmd_identifier "vim.rpcrequest" "vim.rpcnotify")
(#any-of? @_method "\"nvim_exec_lua\"" "'nvim_exec_lua'" "[[nvim_exec_lua]]"))
; highlight string as query if starts with `;; query`
((string ("string_content") @query) (#lua-match? @query "^%s*;+%s?query"))
((comment) @luadoc