mirror of
https://github.com/neovim/neovim.git
synced 2026-01-06 21:37:43 +00:00
backport treesitter parser and queries (#23767)
This commit is contained in:
@@ -127,8 +127,14 @@
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
((identifier) @constant.builtin
|
||||
(#eq? @constant.builtin "_VERSION"))
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#any-of? @variable.builtin "_G" "_VERSION" "debug" "io" "jit" "math" "os" "package" "self" "string" "table" "utf8"))
|
||||
(#eq? @variable.builtin "self"))
|
||||
|
||||
((identifier) @namespace.builtin
|
||||
(#any-of? @namespace.builtin "_G" "debug" "io" "jit" "math" "os" "package" "string" "table" "utf8"))
|
||||
|
||||
((identifier) @keyword.coroutine
|
||||
(#eq? @keyword.coroutine "coroutine"))
|
||||
@@ -210,5 +216,7 @@
|
||||
|
||||
(string) @string @spell
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
;; Error
|
||||
(ERROR) @error
|
||||
|
||||
@@ -13,6 +13,14 @@
|
||||
(#set! injection.language "vim")
|
||||
(#any-of? @_vimcmd_identifier "vim.cmd" "vim.api.nvim_command" "vim.api.nvim_exec2" "vim.api.nvim_cmd"))
|
||||
|
||||
; 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 content: _ @_method) . (string content: _ @injection.content)))
|
||||
(#set! injection.language "lua")
|
||||
(#any-of? @_vimcmd_identifier "vim.rpcrequest" "vim.rpcnotify")
|
||||
(#eq? @_method "nvim_exec_lua"))
|
||||
|
||||
((function_call
|
||||
name: (_) @_vimcmd_identifier
|
||||
arguments: (arguments (string content: _ @injection.content) .))
|
||||
@@ -20,7 +28,7 @@
|
||||
(#any-of? @_vimcmd_identifier "vim.treesitter.query.set" "vim.treesitter.query.parse"))
|
||||
|
||||
;; highlight string as query if starts with `;; query`
|
||||
((string ("string_content") @injection.content)
|
||||
(string content: _ @injection.content
|
||||
(#set! injection.language "query")
|
||||
(#lua-match? @injection.content "^%s*;+%s?query"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user