mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
docs: fix more treesitter parsing errors
This commit is contained in:
parent
1c37553476
commit
6dfbeb0d99
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
@ -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
|
||||||
<
|
<
|
||||||
|
@ -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()
|
||||||
|
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user