aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-02-23 13:02:15 +0100
committerGitHub <noreply@github.com>2023-02-23 13:02:15 +0100
commit0cd0fdf4788b892a85c196b26a4099ae2e86beff (patch)
tree00de2dd45d9a5bb3ba743a22974aa9fded165a08
parent524e1a06432ed7a88c1e183d81812dd48dc18cfb (diff)
parent6dfbeb0d990d24657754463c6ab155c19e7f5f56 (diff)
downloadrneovim-0cd0fdf4788b892a85c196b26a4099ae2e86beff.tar.gz
rneovim-0cd0fdf4788b892a85c196b26a4099ae2e86beff.tar.bz2
rneovim-0cd0fdf4788b892a85c196b26a4099ae2e86beff.zip
Merge pull request #22357 from clason/docs-ts
* Work around tree-sitter-vimdoc parsing errors introduced in a recent PR. * Drop the tolerance of the test to 0 to make sure this doesn't happen again.
-rw-r--r--runtime/doc/diagnostic.txt8
-rw-r--r--runtime/doc/lua-guide.txt2
-rw-r--r--runtime/doc/treesitter.txt11
-rw-r--r--runtime/lua/vim/treesitter.lua6
-rw-r--r--runtime/lua/vim/treesitter/languagetree.lua2
-rw-r--r--runtime/lua/vim/treesitter/query.lua4
-rw-r--r--test/functional/lua/help_spec.lua5
7 files changed, 18 insertions, 20 deletions
diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt
index 7066a3739a..c661bf02bf 100644
--- a/runtime/doc/diagnostic.txt
+++ b/runtime/doc/diagnostic.txt
@@ -40,15 +40,15 @@ requires a namespace.
*diagnostic-structure*
A diagnostic is a Lua table with the following keys. Required keys are
-indicated with (*):
+indicated with (+):
bufnr: Buffer number
- lnum(*): The starting line of the diagnostic
+ lnum(+): The starting line of the diagnostic
end_lnum: The final line of the diagnostic
- col(*): The starting column of the diagnostic
+ col(+): The starting column of the diagnostic
end_col: The final column of the diagnostic
severity: The severity of the diagnostic |vim.diagnostic.severity|
- message(*): The diagnostic text
+ message(+): The diagnostic text
source: The source of the diagnostic
code: The diagnostic code
user_data: Arbitrary data plugins or users can add
diff --git a/runtime/doc/lua-guide.txt b/runtime/doc/lua-guide.txt
index 236905a077..8ea84f8c60 100644
--- a/runtime/doc/lua-guide.txt
+++ b/runtime/doc/lua-guide.txt
@@ -71,7 +71,7 @@ local keyword are not accessible outside of the command. This won't work:
<
You can also use `:lua=`, which is the same as `:lua vim.pretty_print(...)`,
to conveniently check the value of a variable or a table:
->lua
+>vim
:lua=package
<
To run a Lua script in an external file, you can use the |:source| command
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index 16de49029e..3f505e5d19 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -505,8 +505,7 @@ get_captures_at_pos({bufnr}, {row}, {col})
• {col} (integer) Position column
Return: ~
- table[] List of captures `{ capture = "capture name", metadata = { ...
- } }`
+ table[] List of captures `{ capture = "name", metadata = { ... } }`
get_node({opts}) *vim.treesitter.get_node()*
Returns the smallest named node at the given position
@@ -528,7 +527,7 @@ get_node_range({node_or_range}) *vim.treesitter.get_node_range()*
Returns the node's range or an unpacked range table
Parameters: ~
- • {node_or_range} (|TSNode||table) Node or table of positions
+ • {node_or_range} (|TSNode| | table) Node or table of positions
Return: ~
(integer) start_row
@@ -838,7 +837,7 @@ Query:iter_captures({self}, {node}, {source}, {start}, {stop})
-- typically useful info about the node:
local type = node:type() -- type of the captured node
local row1, col1, row2, col2 = node:range() -- range of the capture
- ... use the info here ...
+ -- ... use the info here ...
end
<
@@ -871,7 +870,7 @@ Query:iter_matches({self}, {node}, {source}, {start}, {stop})
local node_data = metadata[id] -- Node level metadata
- ... use the info here ...
+ -- ... use the info here ...
end
end
<
@@ -1017,7 +1016,7 @@ LanguageTree:named_node_for_range({self}, {range}, {opts})
• {self}
Return: ~
- |TSNode||nil Found node
+ |TSNode| | nil Found node
LanguageTree:parse({self}) *LanguageTree:parse()*
Parses all defined regions using a treesitter parser for the language this
diff --git a/runtime/lua/vim/treesitter.lua b/runtime/lua/vim/treesitter.lua
index c1e5325519..44922bbc4d 100644
--- a/runtime/lua/vim/treesitter.lua
+++ b/runtime/lua/vim/treesitter.lua
@@ -157,7 +157,7 @@ end
--- Returns the node's range or an unpacked range table
---
----@param node_or_range (TSNode|table) Node or table of positions
+---@param node_or_range (TSNode | table) Node or table of positions
---
---@return integer start_row
---@return integer start_col
@@ -218,7 +218,7 @@ end
---@param row integer Position row
---@param col integer Position column
---
----@return table[] List of captures `{ capture = "capture name", metadata = { ... } }`
+---@return table[] List of captures `{ capture = "name", metadata = { ... } }`
function M.get_captures_at_pos(bufnr, row, col)
if bufnr == 0 then
bufnr = a.nvim_get_current_buf()
@@ -339,7 +339,7 @@ end
--- - lang string|nil Parser language
--- - ignore_injections boolean Ignore injected languages (default true)
---
----@return TSNode|nil under the cursor
+---@return TSNode | nil Node at the given position
---@deprecated
function M.get_node_at_pos(bufnr, row, col, opts)
vim.deprecate('vim.treesitter.get_node_at_pos()', 'vim.treesitter.get_node()', '0.10')
diff --git a/runtime/lua/vim/treesitter/languagetree.lua b/runtime/lua/vim/treesitter/languagetree.lua
index 81ad83db2c..c9fd4bb2ea 100644
--- a/runtime/lua/vim/treesitter/languagetree.lua
+++ b/runtime/lua/vim/treesitter/languagetree.lua
@@ -653,7 +653,7 @@ end
---@param range Range `{ start_line, start_col, end_line, end_col }`
---@param opts table|nil Optional keyword arguments:
--- - ignore_injections boolean Ignore injected languages (default true)
----@return TSNode|nil Found node
+---@return TSNode | nil Found node
function LanguageTree:named_node_for_range(range, opts)
local tree = self:tree_for_range(range, opts)
if tree then
diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua
index 83910316a6..58a29f2fe0 100644
--- a/runtime/lua/vim/treesitter/query.lua
+++ b/runtime/lua/vim/treesitter/query.lua
@@ -639,7 +639,7 @@ end
--- -- typically useful info about the node:
--- local type = node:type() -- type of the captured node
--- local row1, col1, row2, col2 = node:range() -- range of the capture
---- ... use the info here ...
+--- -- ... use the info here ...
--- end
--- </pre>
---
@@ -693,7 +693,7 @@ end
---
--- local node_data = metadata[id] -- Node level metadata
---
---- ... use the info here ...
+--- -- ... use the info here ...
--- end
--- end
--- </pre>
diff --git a/test/functional/lua/help_spec.lua b/test/functional/lua/help_spec.lua
index b396e2ba30..d66d9f7fbe 100644
--- a/test/functional/lua/help_spec.lua
+++ b/test/functional/lua/help_spec.lua
@@ -21,9 +21,8 @@ describe(':help docs', function()
ok(rv.helpfiles > 100, '>100 :help files', rv.helpfiles)
eq({}, rv.invalid_links, 'invalid tags in :help docs')
eq({}, rv.invalid_urls, 'invalid URLs in :help docs')
- -- Check that parse errors did not increase wildly.
- -- TODO: Fix all parse errors in :help files.
- ok(rv.err_count < 250, '<250 parse errors', rv.err_count)
+ -- Check that parse errors did not increase.
+ ok(rv.err_count == 0, 'no parse errors', rv.err_count)
end)
it('gen_help_html.lua generates HTML', function()