docs(autocmd): generate events enum type #34883

This commit is contained in:
luukvbaal
2025-07-12 16:46:13 +02:00
committed by GitHub
parent 34fbfa3586
commit d2098057a7
6 changed files with 189 additions and 25 deletions

View File

@@ -141,8 +141,12 @@ local function process_proto(item, state)
cur_obj.params = cur_obj.params or {}
for _, p in ipairs(item.parameters) do
local param = { name = p[2], type = api_type(p[1]) }
local event_type = 'vim.api.keyset.events|vim.api.keyset.events[]'
local event = (item.name == 'nvim_create_autocmd' or item.name == 'nvim_exec_autocmds')
and p[2] == 'event'
local param = { name = p[2], type = event and event_type or api_type(p[1]) }
local added = false
for _, cp in ipairs(cur_obj.params) do
if cp.name == param.name then
cp.type = param.type