Skip to content

Commit

Permalink
docs: remove use of debug module for automatically extracting root pa…
Browse files Browse the repository at this point in the history
…ttern (#1799)
  • Loading branch information
mjlbach committed Mar 20, 2022
1 parent 67a2928 commit 9dc0249
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions scripts/docgen.lua
Original file line number Diff line number Diff line change
Expand Up @@ -132,22 +132,7 @@ local function make_lsp_sections()
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')
description = 'see source file'
end
return string.format('- `%s` : \n```lua\n%s\n```', k, description or inspect(v))
end),
Expand Down

0 comments on commit 9dc0249

Please sign in to comment.