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.
This commit is contained in:
Christian Clason 2023-02-23 13:02:15 +01:00 committed by GitHub
commit 0cd0fdf478
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 18 additions and 20 deletions

View File

@ -40,15 +40,15 @@ requires a namespace.
*diagnostic-structure* *diagnostic-structure*
A diagnostic is a Lua table with the following keys. Required keys are A diagnostic is a Lua table with the following keys. Required keys are
indicated with (*): indicated with (+):
bufnr: Buffer number 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 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 end_col: The final column of the diagnostic
severity: The severity of the diagnostic |vim.diagnostic.severity| severity: The severity of the diagnostic |vim.diagnostic.severity|
message(*): The diagnostic text message(+): The diagnostic text
source: The source of the diagnostic source: The source of the diagnostic
code: The diagnostic code code: The diagnostic code
user_data: Arbitrary data plugins or users can add user_data: Arbitrary data plugins or users can add

View File

@ -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(...)`, 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: to conveniently check the value of a variable or a table:
>lua >vim
:lua=package :lua=package
< <
To run a Lua script in an external file, you can use the |:source| command To run a Lua script in an external file, you can use the |:source| command

View File

@ -505,8 +505,7 @@ get_captures_at_pos({bufnr}, {row}, {col})
• {col} (integer) Position column • {col} (integer) Position column
Return: ~ Return: ~
table[] List of captures `{ capture = "capture name", metadata = { ... table[] List of captures `{ capture = "name", metadata = { ... } }`
} }`
get_node({opts}) *vim.treesitter.get_node()* get_node({opts}) *vim.treesitter.get_node()*
Returns the smallest named node at the given position 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 Returns the node's range or an unpacked range table
Parameters: ~ Parameters: ~
• {node_or_range} (|TSNode||table) Node or table of positions • {node_or_range} (|TSNode| | table) Node or table of positions
Return: ~ Return: ~
(integer) start_row (integer) start_row
@ -838,7 +837,7 @@ Query:iter_captures({self}, {node}, {source}, {start}, {stop})
-- typically useful info about the node: -- typically useful info about the node:
local type = node:type() -- type of the captured node local type = node:type() -- type of the captured node
local row1, col1, row2, col2 = node:range() -- range of the capture local row1, col1, row2, col2 = node:range() -- range of the capture
... use the info here ... -- ... use the info here ...
end end
< <
@ -871,7 +870,7 @@ Query:iter_matches({self}, {node}, {source}, {start}, {stop})
local node_data = metadata[id] -- Node level metadata local node_data = metadata[id] -- Node level metadata
... use the info here ... -- ... use the info here ...
end end
end end
< <
@ -1017,7 +1016,7 @@ LanguageTree:named_node_for_range({self}, {range}, {opts})
• {self} • {self}
Return: ~ Return: ~
|TSNode||nil Found node |TSNode| | nil Found node
LanguageTree:parse({self}) *LanguageTree:parse()* LanguageTree:parse({self}) *LanguageTree:parse()*
Parses all defined regions using a treesitter parser for the language this Parses all defined regions using a treesitter parser for the language this

View File

@ -157,7 +157,7 @@ end
--- Returns the node's range or an unpacked range table --- 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_row
---@return integer start_col ---@return integer start_col
@ -218,7 +218,7 @@ end
---@param row integer Position row ---@param row integer Position row
---@param col integer Position column ---@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) function M.get_captures_at_pos(bufnr, row, col)
if bufnr == 0 then if bufnr == 0 then
bufnr = a.nvim_get_current_buf() bufnr = a.nvim_get_current_buf()
@ -339,7 +339,7 @@ end
--- - lang string|nil Parser language --- - lang string|nil Parser language
--- - ignore_injections boolean Ignore injected languages (default true) --- - ignore_injections boolean Ignore injected languages (default true)
--- ---
---@return TSNode|nil under the cursor ---@return TSNode | nil Node at the given position
---@deprecated ---@deprecated
function M.get_node_at_pos(bufnr, row, col, opts) function M.get_node_at_pos(bufnr, row, col, opts)
vim.deprecate('vim.treesitter.get_node_at_pos()', 'vim.treesitter.get_node()', '0.10') vim.deprecate('vim.treesitter.get_node_at_pos()', 'vim.treesitter.get_node()', '0.10')

View File

@ -653,7 +653,7 @@ end
---@param range Range `{ start_line, start_col, end_line, end_col }` ---@param range Range `{ start_line, start_col, end_line, end_col }`
---@param opts table|nil Optional keyword arguments: ---@param opts table|nil Optional keyword arguments:
--- - ignore_injections boolean Ignore injected languages (default true) --- - 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) function LanguageTree:named_node_for_range(range, opts)
local tree = self:tree_for_range(range, opts) local tree = self:tree_for_range(range, opts)
if tree then if tree then

View File

@ -639,7 +639,7 @@ end
--- -- typically useful info about the node: --- -- typically useful info about the node:
--- local type = node:type() -- type of the captured node --- local type = node:type() -- type of the captured node
--- local row1, col1, row2, col2 = node:range() -- range of the capture --- local row1, col1, row2, col2 = node:range() -- range of the capture
--- ... use the info here ... --- -- ... use the info here ...
--- end --- end
--- </pre> --- </pre>
--- ---
@ -693,7 +693,7 @@ end
--- ---
--- local node_data = metadata[id] -- Node level metadata --- local node_data = metadata[id] -- Node level metadata
--- ---
--- ... use the info here ... --- -- ... use the info here ...
--- end --- end
--- end --- end
--- </pre> --- </pre>

View File

@ -21,9 +21,8 @@ describe(':help docs', function()
ok(rv.helpfiles > 100, '>100 :help files', rv.helpfiles) ok(rv.helpfiles > 100, '>100 :help files', rv.helpfiles)
eq({}, rv.invalid_links, 'invalid tags in :help docs') eq({}, rv.invalid_links, 'invalid tags in :help docs')
eq({}, rv.invalid_urls, 'invalid URLs in :help docs') eq({}, rv.invalid_urls, 'invalid URLs in :help docs')
-- Check that parse errors did not increase wildly. -- Check that parse errors did not increase.
-- TODO: Fix all parse errors in :help files. ok(rv.err_count == 0, 'no parse errors', rv.err_count)
ok(rv.err_count < 250, '<250 parse errors', rv.err_count)
end) end)
it('gen_help_html.lua generates HTML', function() it('gen_help_html.lua generates HTML', function()