diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-07-26 21:07:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-26 21:07:39 +0800 |
commit | ccf328172bac2b02f9bd19fa58e105958514a28a (patch) | |
tree | 5165f6c2e14a86768fe2ceb8ff482d0785376086 /scripts | |
parent | fd089c8e50c211d7beae15dbc9492ae5a1a5f2e2 (diff) | |
download | rneovim-ccf328172bac2b02f9bd19fa58e105958514a28a.tar.gz rneovim-ccf328172bac2b02f9bd19fa58e105958514a28a.tar.bz2 rneovim-ccf328172bac2b02f9bd19fa58e105958514a28a.zip |
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.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/gen_vimfn_types.lua | 7 |
1 files changed, 6 insertions, 1 deletions
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('^(<?)\t\t', '%1'):gsub('\t', ' ') end + last_l = l end if last_f then |