aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/docgen.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/docgen.lua b/scripts/docgen.lua
index 33f78130..42ae95cd 100644
--- a/scripts/docgen.lua
+++ b/scripts/docgen.lua
@@ -114,6 +114,23 @@ local function make_lsp_sections()
local description = ((docs or {}).default_config or {})[k]
if description and type(description) ~= 'string' then
description = inspect(description)
+ elseif not description and type(v) == "function" then
+ local info = debug.getinfo(v)
+ local file = io.open(string.sub(info.source, 2), 'r')
+
+ local fileContent = {}
+ for line in file:lines() do
+ table.insert (fileContent, line)
+ end
+ io.close(file)
+
+ local root_dir = {}
+ for i = info.linedefined, info.lastlinedefined do
+ table.insert(root_dir, fileContent[i])
+ end
+
+ description = table.concat(root_dir, '\n')
+ description = string.gsub(description, ".*function", "function")
end
return indent(2, string.format("%s = %s", k, description or inspect(v)))
end)