mirror of
https://github.com/neovim/neovim
synced 2025-07-30 02:11:52 +00:00
docs(lua): typing for vim.fn.winlayout #33817
Problem:
`any[]` means nothing, and the return value is not the same as what's
documented in the comment (eg, Lua returns `{ "row", { { "leaf", 1000 },
{ "leaf", 1001 } } }`, not `{ "row", { "leaf", 1000, "leaf", 1001 } }`)
Solution:
Create two classes (vim.fn.winlayout.leaf and vim.fn.winlayout.branch)
and one alias that links the two together.
Also: Due to LuaLS limitations, there is an empty class,
vim.fn.winlayout.empty
Signed-Off-By: VoxelPrismatic <voxelprismatic@pm.me>
(cherry picked from commit 902b689c4d
)
This commit is contained in:
committed by
github-actions[bot]
parent
9b3426691c
commit
968947b3c3
2
runtime/doc/builtin.txt
generated
2
runtime/doc/builtin.txt
generated
@ -12029,7 +12029,7 @@ winlayout([{tabnr}]) *winlayout()*
|
|||||||
• {tabnr} (`integer?`)
|
• {tabnr} (`integer?`)
|
||||||
|
|
||||||
Return: ~
|
Return: ~
|
||||||
(`any[]`)
|
(`vim.fn.winlayout.ret`)
|
||||||
|
|
||||||
winline() *winline()*
|
winline() *winline()*
|
||||||
The result is a Number, which is the screen line of the cursor
|
The result is a Number, which is the screen line of the cursor
|
||||||
|
@ -297,3 +297,18 @@
|
|||||||
--- A list of dictionaries with information about
|
--- A list of dictionaries with information about
|
||||||
--- undo blocks.
|
--- undo blocks.
|
||||||
--- @field entries vim.fn.undotree.entry[]
|
--- @field entries vim.fn.undotree.entry[]
|
||||||
|
|
||||||
|
--- @class vim.fn.winlayout.leaf
|
||||||
|
--- @field [1] "leaf" Node type
|
||||||
|
--- @field [2] integer winid
|
||||||
|
|
||||||
|
--- @class vim.fn.winlayout.branch
|
||||||
|
--- @field [1] "row" | "col" Node type
|
||||||
|
--- @field [2] (vim.fn.winlayout.leaf|vim.fn.winlayout.branch)[] children
|
||||||
|
|
||||||
|
--- @class vim.fn.winlayout.empty
|
||||||
|
|
||||||
|
--- @alias vim.fn.winlayout.ret
|
||||||
|
--- | vim.fn.winlayout.leaf
|
||||||
|
--- | vim.fn.winlayout.branch
|
||||||
|
--- | vim.fn.winlayout.empty
|
||||||
|
2
runtime/lua/vim/_meta/vimfn.lua
generated
2
runtime/lua/vim/_meta/vimfn.lua
generated
@ -10929,7 +10929,7 @@ function vim.fn.winheight(nr) end
|
|||||||
--- <
|
--- <
|
||||||
---
|
---
|
||||||
--- @param tabnr? integer
|
--- @param tabnr? integer
|
||||||
--- @return any[]
|
--- @return vim.fn.winlayout.ret
|
||||||
function vim.fn.winlayout(tabnr) end
|
function vim.fn.winlayout(tabnr) end
|
||||||
|
|
||||||
--- The result is a Number, which is the screen line of the cursor
|
--- The result is a Number, which is the screen line of the cursor
|
||||||
|
@ -13239,7 +13239,7 @@ M.funcs = {
|
|||||||
]=],
|
]=],
|
||||||
name = 'winlayout',
|
name = 'winlayout',
|
||||||
params = { { 'tabnr', 'integer' } },
|
params = { { 'tabnr', 'integer' } },
|
||||||
returns = 'any[]',
|
returns = 'vim.fn.winlayout.ret',
|
||||||
signature = 'winlayout([{tabnr}])',
|
signature = 'winlayout([{tabnr}])',
|
||||||
},
|
},
|
||||||
winline = {
|
winline = {
|
||||||
|
Reference in New Issue
Block a user