fix(vim.iter): add richer generic annotations

Improve the vim.iter annotations with richer generics that track element and
tuple types through iterator pipelines, including multi-value stages and
list-specific methods.

Extend the LuaCATS parser and vimdoc generator so those richer generic classes
and overloads round-trip into the generated help. These annotations are only
supported by EmmyLua, so LuaLS still uses a broader fallback in _meta.lua.

AI-assisted: Codex
This commit is contained in:
Lewis Russell
2026-04-20 15:22:32 +01:00
committed by Lewis Russell
parent 2b7a00746d
commit d7ef55e881
7 changed files with 602 additions and 424 deletions

View File

@@ -178,6 +178,32 @@ describe('luacats grammar', function()
parent = 'vim.diagnostic.GetOpts',
})
test('@class vim.Iter<V1, V...>', {
kind = 'class',
name = 'vim.Iter',
generics = { 'V1', 'V...' },
})
test('@class vim.IterArray<T> : vim.Iter<T, never>', {
kind = 'class',
name = 'vim.IterArray',
generics = { 'T' },
parent = 'vim.Iter',
parent_generics = { 'T', 'never' },
})
test('@class vim.lsp.Client.Progress: vim.Ringbuf<{token: integer|string, value: any}>', {
kind = 'class',
name = 'vim.lsp.Client.Progress',
parent = 'vim.Ringbuf',
parent_generics = { '{token: integer|string, value: any}' },
})
test('@overload fun<V1, V2, V...>(self: vim.Iter<V1, V2, V...>): [V1, V2, V...][]', {
kind = 'overload',
type = 'fun<V1, V2, V...>(self: vim.Iter<V1, V2, V...>): [V1, V2, V...][]',
})
test('@param opt? { cmd?: string[] } Options', {
kind = 'param',
name = 'opt?',