diff options
author | C3pa <41503714+C3pa@users.noreply.github.com> | 2022-05-28 21:10:54 +0200 |
---|---|---|
committer | C3pa <41503714+C3pa@users.noreply.github.com> | 2022-05-28 21:10:54 +0200 |
commit | a570167f3cd6a6ee05d08022b88689685202efff (patch) | |
tree | 91c98509652d909fd768fc885663e432413036ac /tools/lovr-api.lua | |
parent | 7eaec047d708e84a7c29dd9d70e306d90fac412d (diff) | |
download | lua-language-server-a570167f3cd6a6ee05d08022b88689685202efff.zip |
Add optional for overloads
Diffstat (limited to 'tools/lovr-api.lua')
-rw-r--r-- | tools/lovr-api.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/lovr-api.lua b/tools/lovr-api.lua index d61bfdb7..dfa2bff8 100644 --- a/tools/lovr-api.lua +++ b/tools/lovr-api.lua @@ -128,10 +128,11 @@ local function buildDocFunc(variant, overload) if param.name == '...' then params[#params+1] = '...' else + local optional = (param.type == 'table' and isTableOptional(param.table) or (param.default ~= nil)) and '?' or '' if param.name:find '^[\'"]' then - params[#params+1] = ('%s: %s|%q'):format(param.name:sub(2, -2), getTypeName(param.type), param.name) + params[#params+1] = ('%s%s: %s|%q'):format(param.name:sub(2, -2), optional, getTypeName(param.type), param.name) else - params[#params+1] = ('%s: %s'):format(param.name, getTypeName(param.type)) + params[#params+1] = ('%s%s: %s'):format(param.name, optional, getTypeName(param.type)) end end end |