diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-11-01 21:00:14 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-11-01 21:00:14 +0800 |
commit | dda6b1860cf9e2efbc6b06bad4a6174481c7e5d9 (patch) | |
tree | f307a7c89f2d422e14018aa5b2be4a97f4d93adb /tools/lovr-api.lua | |
parent | 0b81d41fff711a17e0856b55471909808c1a7812 (diff) | |
download | lua-language-server-dda6b1860cf9e2efbc6b06bad4a6174481c7e5d9.zip |
update lovr
Diffstat (limited to 'tools/lovr-api.lua')
-rw-r--r-- | tools/lovr-api.lua | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/lovr-api.lua b/tools/lovr-api.lua index 5d382875..c5d7f95f 100644 --- a/tools/lovr-api.lua +++ b/tools/lovr-api.lua @@ -64,7 +64,7 @@ function buildType(param) if param.table then return buildDocTable(param.table) end - return getTypeName(param.type) + return getTypeName(param.type or param.name) end local function buildSuper(tp) @@ -168,6 +168,21 @@ local function buildFile(defs) text[#text+1] = buildFunction(func) end + for _, obj in ipairs(defs.objects or {}) do + local mark = {} + text[#text+1] = '' + text[#text+1] = buildDescription(obj.description) + text[#text+1] = ('---@class %s%s'):format(getTypeName(obj.name), buildSuper(obj)) + text[#text+1] = ('local %s = {}'):format(obj.name) + for _, func in ipairs(obj.methods or {}) do + if not mark[func.name] then + mark[func.name] = true + text[#text+1] = '' + text[#text+1] = buildFunction(func) + end + end + end + for _, cb in ipairs(defs.callbacks or {}) do text[#text+1] = '' text[#text+1] = buildDescription(cb.description) |