mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
docs: fix more treesitter parsing errors
This commit is contained in:
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
@ -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
|
||||
<
|
||||
|
@ -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()
|
||||
|
@ -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>
|
||||
|
Reference in New Issue
Block a user