aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/generators/gen_api_dispatch.lua
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2023-08-01 14:20:44 +0100
committerGitHub <noreply@github.com>2023-08-01 14:20:44 +0100
commit48d533272e57e91e4d14c93b26d4922957f40cd7 (patch)
tree9958147e5e1cbc0f880a9d240c4ee02e39614747 /src/nvim/generators/gen_api_dispatch.lua
parente55e80d51ca5d85770981bffb9254badc3662e0c (diff)
downloadrneovim-48d533272e57e91e4d14c93b26d4922957f40cd7.tar.gz
rneovim-48d533272e57e91e4d14c93b26d4922957f40cd7.tar.bz2
rneovim-48d533272e57e91e4d14c93b26d4922957f40cd7.zip
feat(lua-types): types for vim.api.* (#24523)
Diffstat (limited to 'src/nvim/generators/gen_api_dispatch.lua')
-rw-r--r--src/nvim/generators/gen_api_dispatch.lua14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/nvim/generators/gen_api_dispatch.lua b/src/nvim/generators/gen_api_dispatch.lua
index bf211f5273..1b0565d9b6 100644
--- a/src/nvim/generators/gen_api_dispatch.lua
+++ b/src/nvim/generators/gen_api_dispatch.lua
@@ -71,7 +71,7 @@ local function add_keyset(val)
if field.type ~= 'Object' then
error 'not yet implemented: types other than Object'
end
- table.insert(keys, field.name)
+ table.insert(keys, {field.name, field.type})
end
table.insert(keysets, {val.keyset_name, keys})
end
@@ -242,13 +242,16 @@ for _,keyset in ipairs(keysets) do
return key
end
+ local key_names = {}
for i = 1,#keys do
- if vim.endswith(keys[i], "_") then
- keys[i] = string.sub(keys[i],1, #(keys[i]) - 1)
- special[keys[i]] = true
+ local kname = keys[i][1]
+ if vim.endswith(kname, "_") then
+ kname = string.sub(kname,1, #kname - 1)
+ special[kname] = true
end
+ key_names[i] = kname
end
- local neworder, hashfun = hashy.hashy_hash(name, keys, function (idx)
+ local neworder, hashfun = hashy.hashy_hash(name, key_names, function (idx)
return name.."_table["..idx.."].str"
end)
@@ -502,6 +505,7 @@ output:write(hashfun)
output:close()
+functions.keysets = keysets
local mpack_output = io.open(mpack_outputf, 'wb')
mpack_output:write(mpack.encode(functions))
mpack_output:close()