aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake.deps/CMakeLists.txt4
-rw-r--r--runtime/doc/api.txt5
-rw-r--r--runtime/doc/treesitter.txt34
-rw-r--r--runtime/lua/vim/diagnostic.lua1
-rw-r--r--runtime/lua/vim/treesitter.lua20
-rw-r--r--src/nvim/api/autocmd.c3
-rw-r--r--src/nvim/testdir/test_excmd.vim1
-rw-r--r--test/functional/treesitter/highlight_spec.lua4
8 files changed, 42 insertions, 30 deletions
diff --git a/cmake.deps/CMakeLists.txt b/cmake.deps/CMakeLists.txt
index 5ca610ba1f..f9992d3c01 100644
--- a/cmake.deps/CMakeLists.txt
+++ b/cmake.deps/CMakeLists.txt
@@ -204,8 +204,8 @@ set(LIBICONV_SHA256 ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc891
set(TREESITTER_C_URL https://github.com/tree-sitter/tree-sitter-c/archive/v0.20.2.tar.gz)
set(TREESITTER_C_SHA256 af66fde03feb0df4faf03750102a0d265b007e5d957057b6b293c13116a70af2 )
-set(TREESITTER_LUA_URL https://github.com/MunifTanjim/tree-sitter-lua/archive/v0.0.12.tar.gz)
-set(TREESITTER_LUA_SHA256 b6d7c6d04e9101a2e589d25f1d61668301e776c0b8defa6eae8dd86272e9e7c3)
+set(TREESITTER_LUA_URL https://github.com/MunifTanjim/tree-sitter-lua/archive/v0.0.13.tar.gz)
+set(TREESITTER_LUA_SHA256 564594fe0ffd2f2fb3578a15019b723e1bc94ac82cb6a0103a6b3b9ddcc6f315)
set(TREESITTER_VIM_URL https://github.com/vigoux/tree-sitter-viml/archive/v0.2.0.tar.gz)
set(TREESITTER_VIM_SHA256 608dcc31a7948cb66ae7f45494620e2e9face1af75598205541f80d782ec4501)
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 00a3759936..7e55bb8f4e 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -3378,7 +3378,10 @@ nvim_get_autocmds({*opts}) *nvim_get_autocmds()*
• event (string|array): event or events to match against
|autocmd-events|.
• pattern (string|array): pattern or patterns to match against
- |autocmd-pattern|.
+ |autocmd-pattern|. Cannot be used with {buffer}
+ • buffer: Buffer number or list of buffer numbers for buffer
+ local autocommands |autocmd-buflocal|. Cannot be used with
+ {pattern}
Return: ~
Array of autocommands matching the criteria, with each item containing
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index dc81a31856..eda1a5e496 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -203,7 +203,7 @@ purpose, e.g., `queries/lua/highlights.scm` for highlighting Lua files.
By default, the first query on `runtimepath` is used (which usually implies
that user config takes precedence over plugins, which take precedence over
queries bundled with Neovim). If a query should extend other queries instead
-of replacing them, use |ts-query-modeline-extends|.
+of replacing them, use |treesitter-query-modeline-extends|.
See |lua-treesitter-query| for the list of available methods for working with
treesitter queries from Lua.
@@ -220,28 +220,28 @@ to only match identifier corresponding to the `"foo"` text.
The following predicates are built in:
- `eq?` *ts-predicate-eq?*
+ `eq?` *treesitter-predicate-eq?*
Match a string against the text corresponding to a node: >
((identifier) @foo (#eq? @foo "foo"))
((node1) @left (node2) @right (#eq? @left @right))
<
- `match?` *ts-predicate-match?*
- `vim-match?` *ts-predicate-vim-match?*
+ `match?` *treesitter-predicate-match?*
+ `vim-match?` *treesitter-predicate-vim-match?*
Match a |regexp| against the text corresponding to a node: >
((identifier) @constant (#match? @constant "^[A-Z_]+$"))
< Note: The `^` and `$` anchors will match the start and end of the
node's text.
- `lua-match?` *ts-predicate-lua-match?*
+ `lua-match?` *treesitter-predicate-lua-match?*
Match a |lua-pattern| against the text corresponding to a node,
similar to `match?`
- `contains?` *ts-predicate-contains?*
+ `contains?` *treesitter-predicate-contains?*
Match a string against parts of the text corresponding to a node: >
((identifier) @foo (#contains? @foo "foo"))
((identifier) @foo-bar (#contains @foo-bar "foo" "bar"))
<
- `any-of?` *ts-predicate-any-of?*
+ `any-of?` *treesitter-predicate-any-of?*
Match any of the given strings against the text corresponding to
a node: >
((identifier) @foo (#any-of? @foo "foo" "bar"))
@@ -267,7 +267,7 @@ effects. For example, the |set!| predicate sets metadata on the match or node: >
<
The following directives are built in:
- `set!` *ts-directive-set!*
+ `set!` *treesitter-directive-set!*
Sets key/value metadata for a specific match or capture. Value is
accessible as either `metadata[key]` (match specific) or
`metadata[capture_id][key]` (capture specific).
@@ -281,7 +281,7 @@ The following directives are built in:
((identifier) @foo (#set! @foo "kind" "parameter"))
((node1) @left (node2) @right (#set! "type" "pair"))
<
- `offset!` *ts-directive-offset!*
+ `offset!` *treesitter-directive-offset!*
Takes the range of the captured node and applies an offset. This will
generate a new range object for the captured node as
`metadata[capture_id].range`.
@@ -302,13 +302,13 @@ Use `vim.treesitter.query.`|list_directives()| to list all available
directives.
-TREESITTER QUERY MODELINES *ts-query-modeline*
+TREESITTER QUERY MODELINES *treesitter-query-modeline*
Neovim supports to customize the behavior of the queries using a set of
"modelines", that is comments in the queries starting with `;`. Here are the
currently supported modeline alternatives:
- `inherits: {lang}...` *ts-query-modeline-inherits*
+ `inherits: {lang}...` *treesitter-query-modeline-inherits*
Specifies that this query should inherit the queries from {lang}.
This will recursively descend in the queries of {lang} unless wrapped
in parentheses: `({lang})`.
@@ -316,7 +316,7 @@ currently supported modeline alternatives:
language. If you want your query to extend the queries of the same
language, use `extends`.
- `extends` *ts-query-modeline-extends*
+ `extends` *treesitter-query-modeline-extends*
Specifies that this query should be used as an extension for the
query, i.e. that it should be merged with the others.
Note: The order of the extensions, and the query that will be used as
@@ -436,14 +436,20 @@ get_captures_at_cursor({winnr}) *get_captures_at_cursor()*
*get_captures_at_position()*
get_captures_at_position({bufnr}, {row}, {col})
+ Returns a list of highlight captures at the given position
+
+ Each capture is represented by a table containing the capture name as a
+ string as well as a table of metadata (`priority`, `conceal`, ...; empty
+ if none are defined).
+
Parameters: ~
{bufnr} (number) Buffer number (0 for current buffer)
{row} (number) Position row
{col} (number) Position column
Return: ~
- table[] Captures of the form `{ capture = "capture name", priority =
- capture priority }`
+ table[] List of captures `{ capture = "capture name", metadata = { ...
+ } }`
get_node_at_cursor({winnr}) *get_node_at_cursor()*
Returns the smallest named node under the cursor
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua
index 172bd867c7..98dbe0779b 100644
--- a/runtime/lua/vim/diagnostic.lua
+++ b/runtime/lua/vim/diagnostic.lua
@@ -1426,6 +1426,7 @@ function M.reset(namespace, bufnr)
vim.api.nvim_exec_autocmds('DiagnosticChanged', {
modeline = false,
buffer = iter_bufnr,
+ data = { diagnostics = {} },
})
end
end
diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua
index 89aa611acd..04e12cbe0b 100644
--- a/runtime/lua/vim/treesitter.lua
+++ b/runtime/lua/vim/treesitter.lua
@@ -154,7 +154,7 @@ function M.get_node_range(node_or_range)
end
end
----Determines whether (line, col) position is in node range
+--- Determines whether (line, col) position is in node range
---
---@param node userdata |tsnode| defining the range
---@param line number Line (0-based)
@@ -178,7 +178,8 @@ function M.is_in_node_range(node, line, col)
end
end
----Determines if a node contains a range
+--- Determines if a node contains a range
+---
---@param node userdata |tsnode|
---@param range table
---
@@ -191,17 +192,16 @@ function M.node_contains(node, range)
return start_fits and end_fits
end
----Returns a list of highlight captures at the given position
---
----@param bufnr number Buffer number (0 for current buffer)
----@param row number Position row
----@param col number Position column
+--- Returns a list of highlight captures at the given position
+---
+--- Each capture is represented by a table containing the capture name as a string as
+--- well as a table of metadata (`priority`, `conceal`, ...; empty if none are defined).
---
---@param bufnr number Buffer number (0 for current buffer)
---@param row number Position row
---@param col number Position column
---
----@return table[] Captures of the form `{ capture = "capture name", priority = capture priority }`
+---@return table[] List of captures `{ capture = "capture name", metadata = { ... } }`
function M.get_captures_at_position(bufnr, row, col)
if bufnr == 0 then
bufnr = a.nvim_get_current_buf()
@@ -240,7 +240,7 @@ function M.get_captures_at_position(bufnr, row, col)
if M.is_in_node_range(node, row, col) then
local c = q._query.captures[capture] -- name of the capture in the query
if c ~= nil then
- table.insert(matches, { capture = c, priority = metadata.priority })
+ table.insert(matches, { capture = c, metadata = metadata })
end
end
end
@@ -248,7 +248,7 @@ function M.get_captures_at_position(bufnr, row, col)
return matches
end
----Returns a list of highlight capture names under the cursor
+--- Returns a list of highlight capture names under the cursor
---
---@param winnr (number|nil) Window handle or 0 for current window (default)
---
diff --git a/src/nvim/api/autocmd.c b/src/nvim/api/autocmd.c
index 99340a3c59..ac4cb953b8 100644
--- a/src/nvim/api/autocmd.c
+++ b/src/nvim/api/autocmd.c
@@ -59,6 +59,9 @@ static int64_t next_autocmd_id = 1;
/// - group (string|integer): the autocommand group name or id to match against.
/// - event (string|array): event or events to match against |autocmd-events|.
/// - pattern (string|array): pattern or patterns to match against |autocmd-pattern|.
+/// Cannot be used with {buffer}
+/// - buffer: Buffer number or list of buffer numbers for buffer local autocommands
+/// |autocmd-buflocal|. Cannot be used with {pattern}
/// @return Array of autocommands matching the criteria, with each item
/// containing the following fields:
/// - id (number): the autocommand id (only when defined with the API).
diff --git a/src/nvim/testdir/test_excmd.vim b/src/nvim/testdir/test_excmd.vim
index 9a9e5c546b..caa9b76fda 100644
--- a/src/nvim/testdir/test_excmd.vim
+++ b/src/nvim/testdir/test_excmd.vim
@@ -230,7 +230,6 @@ endfunc
" Test for the :language command
func Test_language_cmd()
CheckNotMSWindows " FIXME: why does this fail on Windows CI?
- CheckNotBSD " FIXME: why does this fail on OpenBSD CI?
CheckFeature multi_lang
call assert_fails('language ctype non_existing_lang', 'E197:')
diff --git a/test/functional/treesitter/highlight_spec.lua b/test/functional/treesitter/highlight_spec.lua
index d557b2c012..1684337c3c 100644
--- a/test/functional/treesitter/highlight_spec.lua
+++ b/test/functional/treesitter/highlight_spec.lua
@@ -605,8 +605,8 @@ describe('treesitter highlighting', function()
}}
eq({
- {capture='Error', priority='101'};
- {capture='type'};
+ {capture='Error', metadata = { priority='101' }};
+ {capture='type', metadata = { } };
}, exec_lua [[ return vim.treesitter.get_captures_at_position(0, 0, 2) ]])
end)