summaryrefslogtreecommitdiff
path: root/tools/love-api.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-07-20 20:15:53 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-07-20 20:15:53 +0800
commit86616712e365dd84d03a559f5b69c5e87ab5eed1 (patch)
tree3aef774af7cd7053e911f707da8ee0b755114479 /tools/love-api.lua
parent2646668ef25f8a90d07f2cc929a037e62c729381 (diff)
downloadlua-language-server-86616712e365dd84d03a559f5b69c5e87ab5eed1.zip
update
Diffstat (limited to 'tools/love-api.lua')
-rw-r--r--tools/love-api.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/love-api.lua b/tools/love-api.lua
index 954d542f..67cebeca 100644
--- a/tools/love-api.lua
+++ b/tools/love-api.lua
@@ -57,7 +57,7 @@ local function buildDocTable(tbl)
local fields = {}
for _, field in ipairs(tbl) do
if field.name ~= '...' then
- fields[#fields+1] = ('%s: %s'):format(formatIndex(field.name), field.type)
+ fields[#fields+1] = ('%s: %s'):format(formatIndex(field.name), buildType(field))
end
end
return ('{%s}'):format(table.concat(fields, ', '))
@@ -93,7 +93,15 @@ local function buildDocFunc(variant)
local params = {}
local returns = {}
for _, param in ipairs(variant.arguments or {}) do
- params[#params+1] = ('%s: %s'):format(param.name, getTypeName(param.type))
+ if param.name == '...' then
+ params[#params+1] = '...'
+ else
+ if param.name:find '^[\'"]' then
+ params[#params+1] = ('%s: %s|%q'):format(param.name:sub(2, -2), getTypeName(param.type), param.name)
+ else
+ params[#params+1] = ('%s: %s'):format(param.name, getTypeName(param.type))
+ end
+ end
end
for _, rtn in ipairs(variant.returns or {}) do
returns[#returns+1] = ('%s'):format(getTypeName(rtn.type))