From 42333ea98dfcd2994ee128a3467dfe68205154cd Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Fri, 28 Jul 2023 14:48:41 +0100 Subject: feat(docs): generate builtin.txt (#24493) - eval.lua is now the source of truth. - Formatting is much more consistent. - Fixed Lua type generation for polymorphic functions (get(), etc). - Removed "Overview" section from builtin.txt - Can generate this if we really want it. - Moved functions from sign.txt and testing.txt into builtin.txt. - Removed the *timer* *timers* tags since libuv timers via vim.uv should be preferred. - Removed the temp-file-name tag from tempname() - Moved lueval() from lua.txt to builtin.txt. * Fix indent * fixup! * fixup! fixup! * fixup! better tag formatting * fixup: revert changes no longer needed * fixup! CI --------- Co-authored-by: zeertzjq --- src/nvim/generators/gen_eval.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/nvim/generators') diff --git a/src/nvim/generators/gen_eval.lua b/src/nvim/generators/gen_eval.lua index 6858fbc917..c7978f0d19 100644 --- a/src/nvim/generators/gen_eval.lua +++ b/src/nvim/generators/gen_eval.lua @@ -10,7 +10,7 @@ local funcsfname = autodir .. '/funcs.generated.h' local hashy = require'generators.hashy' -local hashpipe = io.open(funcsfname, 'wb') +local hashpipe = assert(io.open(funcsfname, 'wb')) hashpipe:write([[ #include "nvim/arglist.h" @@ -62,16 +62,22 @@ for _,fun in ipairs(metadata) do end end -local func_names = vim.tbl_keys(funcs) +local func_names = vim.tbl_filter(function(name) + return name:match('__%d*$') == nil +end, vim.tbl_keys(funcs)) + table.sort(func_names) -local funcsdata = io.open(funcs_file, 'w') + +local funcsdata = assert(io.open(funcs_file, 'w')) funcsdata:write(mpack.encode(func_names)) funcsdata:close() local neworder, hashfun = hashy.hashy_hash("find_internal_func", func_names, function (idx) return "functions["..idx.."].name" end) + hashpipe:write("static const EvalFuncDef functions[] = {\n") + for _, name in ipairs(neworder) do local def = funcs[name] local args = def.args or 0 -- cgit