diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-07-10 08:07:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-10 08:07:16 +0800 |
commit | 545aafbeb80eb52c182ce139800489b392a12d0d (patch) | |
tree | 580a4c7a0f42bddae3b4577054b8758906d4d631 /scripts | |
parent | f3c7fb9db176f32606e83eb47cc7549300191d2f (diff) | |
download | rneovim-545aafbeb80eb52c182ce139800489b392a12d0d.tar.gz rneovim-545aafbeb80eb52c182ce139800489b392a12d0d.tar.bz2 rneovim-545aafbeb80eb52c182ce139800489b392a12d0d.zip |
vim-patch:9.1.0547: No way to get the arity of a Vim function (#29638)
Problem: No way to get the arity of a Vim function
(Austin Ziegler)
Solution: Enhance get() Vim script function to return the function
argument info using get(func, "arity") (LemonBoy)
fixes: vim/vim#15097
closes: vim/vim#15109
https://github.com/vim/vim/commit/48b7d05a4f88c4326bd5d7a73a523f2d953b3e51
Co-authored-by: LemonBoy <thatlemon@gmail.com>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/gen_eval_files.lua | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/scripts/gen_eval_files.lua b/scripts/gen_eval_files.lua index 76092f8b39..b490e7b480 100755 --- a/scripts/gen_eval_files.lua +++ b/scripts/gen_eval_files.lua @@ -432,14 +432,15 @@ local function render_eval_meta(f, fun, write) end --- @param name string +--- @param name_tag boolean --- @param fun vim.EvalFn --- @param write fun(line: string) -local function render_sig_and_tag(name, fun, write) +local function render_sig_and_tag(name, name_tag, fun, write) if not fun.signature then return end - local tags = { '*' .. name .. '()*' } + local tags = name_tag and { '*' .. name .. '()*' } or {} if fun.tags then for _, t in ipairs(fun.tags) do @@ -447,6 +448,11 @@ local function render_sig_and_tag(name, fun, write) end end + if #tags == 0 then + write(fun.signature) + return + end + local tag = table.concat(tags, ' ') local siglen = #fun.signature local conceal_offset = 2 * (#tags - 1) @@ -472,11 +478,7 @@ local function render_eval_doc(f, fun, write) return end - if f:find('__%d+$') then - write(fun.signature) - else - render_sig_and_tag(fun.name or f, fun, write) - end + render_sig_and_tag(fun.name or f, not f:find('__%d+$'), fun, write) if not fun.desc then return |