diff options
author | Riley Bruins <ribru17@hotmail.com> | 2024-10-03 16:57:19 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-03 16:57:19 -0700 |
commit | f62728cd80a9c458b1c0ef7c5c1251e55fe91090 (patch) | |
tree | c4bdaeb09ae28b856738c0afce4cedb7e9a2bdb8 /runtime/lua/vim/treesitter/_meta/tstree.lua | |
parent | 385fbfb3e739b457027b469782678f86eefdf7fc (diff) | |
download | rneovim-f62728cd80a9c458b1c0ef7c5c1251e55fe91090.tar.gz rneovim-f62728cd80a9c458b1c0ef7c5c1251e55fe91090.tar.bz2 rneovim-f62728cd80a9c458b1c0ef7c5c1251e55fe91090.zip |
docs(treesitter): generate TSNode, TSTree docs #30643
**Problem:** The documentation for `TSNode` and `TSTree` methods is
incomplete from the LSP perspective. This is because they are written
directly to the vimdoc, rather than in Lua and generated to vimdoc.
**Solution:** Migrate the docs to Lua and generate them into the vimdoc.
This requires breaking up the `treesitter/_meta.lua` file into a
directory with a few different modules.
This commit also makes the vimdoc generator slightly more robust with
regard to sections that have multiple help tags (e.g. `*one* *two*`)
Diffstat (limited to 'runtime/lua/vim/treesitter/_meta/tstree.lua')
-rw-r--r-- | runtime/lua/vim/treesitter/_meta/tstree.lua | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/runtime/lua/vim/treesitter/_meta/tstree.lua b/runtime/lua/vim/treesitter/_meta/tstree.lua new file mode 100644 index 0000000000..24cb60040e --- /dev/null +++ b/runtime/lua/vim/treesitter/_meta/tstree.lua @@ -0,0 +1,44 @@ +---@meta +-- luacheck: no unused args +error('Cannot require a meta file') + +--- @brief A "treesitter tree" represents the parsed contents of a buffer, which can be +--- used to perform further analysis. It is a |userdata| reference to an object +--- held by the treesitter library. +--- +--- An instance `TSTree` of a treesitter tree supports the following methods. + +---@nodoc +---@class TSTree: userdata +local TSTree = {} -- luacheck: no unused + +--- Return the root node of this tree. +---@return TSNode +function TSTree:root() end + +-- stylua: ignore +---@param start_byte integer +---@param end_byte_old integer +---@param end_byte_new integer +---@param start_row integer +---@param start_col integer +---@param end_row_old integer +---@param end_col_old integer +---@param end_row_new integer +---@param end_col_new integer +---@nodoc +function TSTree:edit(start_byte, end_byte_old, end_byte_new, start_row, start_col, end_row_old, end_col_old, end_row_new, end_col_new) end + +--- Returns a copy of the `TSTree`. +---@return TSTree +function TSTree:copy() end + +---@param include_bytes true +---@return Range6[] +---@nodoc +function TSTree:included_ranges(include_bytes) end + +---@param include_bytes false +---@return Range4[] +---@nodoc +function TSTree:included_ranges(include_bytes) end |