From ccf328172bac2b02f9bd19fa58e105958514a28a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 26 Jul 2023 21:07:39 +0800 Subject: fix(gen_vimfn_types): don't include tag before signature's line (#24492) When signature is a bit long or there are too many tags, the tags appear before the signature's line. Don't include the line with tags in the previous function' docs. Also fix lint warnings. --- scripts/gen_vimfn_types.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/gen_vimfn_types.lua b/scripts/gen_vimfn_types.lua index f0dfd0665c..32de1d3c95 100755 --- a/scripts/gen_vimfn_types.lua +++ b/scripts/gen_vimfn_types.lua @@ -95,6 +95,7 @@ local function process_source(source) local lines = {} --- @type string[] local last_f --- @type string? + local last_l --- @type string? for i = s, #src_lines do local l = src_lines[i] @@ -104,11 +105,14 @@ local function process_source(source) local f = l:match('^([a-z][a-zA-Z0-9_]*)%(') if f then if last_f then + if last_l and last_l:find('*' .. f .. '()*', 1, true) then + lines[#lines] = nil + end funcs[last_f].desc = lines end last_f = f local sig = l:match('[^)]+%)') - local params = {} --- @type string[] + local params = {} --- @type table[] if sig then for param in string.gmatch(sig, '{([a-z][a-zA-Z0-9_]*)}') do local t = ARG_NAME_TYPES[param] or 'any' @@ -125,6 +129,7 @@ local function process_source(source) else lines[#lines+1] = l:gsub('^(