aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2024-10-05 08:52:57 -0700
committerGitHub <noreply@github.com>2024-10-05 08:52:57 -0700
commit8801b77ed09876605e42f4a3fddf8c020c14b711 (patch)
tree4d13449225e1773b03e50d684c1fbdbdad743cde /scripts
parent0c9b3ef34dea3b957c2501601f44f1154236abf8 (diff)
downloadrneovim-8801b77ed09876605e42f4a3fddf8c020c14b711.tar.gz
rneovim-8801b77ed09876605e42f4a3fddf8c020c14b711.tar.bz2
rneovim-8801b77ed09876605e42f4a3fddf8c020c14b711.zip
fix(docs): missing `@returns` desc in _meta/api.lua #30673
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/gen_eval_files.lua7
-rw-r--r--scripts/util.lua13
2 files changed, 16 insertions, 4 deletions
diff --git a/scripts/gen_eval_files.lua b/scripts/gen_eval_files.lua
index 234028b972..095daaeb21 100755
--- a/scripts/gen_eval_files.lua
+++ b/scripts/gen_eval_files.lua
@@ -276,7 +276,7 @@ local function get_api_meta()
if not deprecated then
r.desc = fun.desc
- r.return_desc = fun.returns[1].desc
+ r.returns_desc = fun.returns[1].desc
end
ret[fun.name] = r
@@ -370,10 +370,9 @@ local function render_api_meta(_f, fun, write)
end
if fun.returns ~= '' then
- local ret_desc = fun.returns_desc and ' : ' .. fun.returns_desc or ''
- ret_desc = util.md_to_vimdoc(ret_desc, 0, 0, 74)
+ local ret_desc = fun.returns_desc and ' # ' .. fun.returns_desc or ''
local ret = LUA_API_RETURN_OVERRIDES[fun.name] or fun.returns
- write('--- @return ' .. ret .. ret_desc)
+ write(util.prefix('--- ', '@return ' .. ret .. ret_desc))
end
local param_str = table.concat(param_names, ', ')
diff --git a/scripts/util.lua b/scripts/util.lua
index 6343ad4b21..dda18fb807 100644
--- a/scripts/util.lua
+++ b/scripts/util.lua
@@ -173,6 +173,19 @@ local function parse_md(text)
return extract(root) or {}
end
+--- Prefixes each line in `text`.
+---
+--- Does not wrap, that's not important for "meta" files? (You probably want md_to_vimdoc instead.)
+---
+--- @param text string
+--- @param prefix_ string
+function M.prefix(prefix_, text)
+ if (text):find('\n$') then
+ return text:gsub('([^\n]*)[\t ]*\n', prefix_ .. '%1\n')
+ end
+ return prefix_ .. text:gsub('([^\n]*)[\t ]*\n', '%1\n' .. prefix_)
+end
+
--- @param x string
--- @param start_indent integer
--- @param indent integer