diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-20 21:44:57 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-20 21:44:57 +0800 |
commit | 4f2e91dad259b6559cec651b10718e1a19352fc3 (patch) | |
tree | 581b8bdc73440ded32db5cb0a1a191a02fa64372 /script-beta/core/hover/arg.lua | |
parent | 9cd44e1b61fa8f002b211224e0141812a8fc97e6 (diff) | |
download | lua-language-server-4f2e91dad259b6559cec651b10718e1a19352fc3.zip |
use meta instead of library
Diffstat (limited to 'script-beta/core/hover/arg.lua')
-rw-r--r-- | script-beta/core/hover/arg.lua | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/script-beta/core/hover/arg.lua b/script-beta/core/hover/arg.lua index 4ea2cafe..9cd19f02 100644 --- a/script-beta/core/hover/arg.lua +++ b/script-beta/core/hover/arg.lua @@ -1,61 +1,6 @@ local guide = require 'parser.guide' local vm = require 'vm' -local function mergeTypesInLibrary(types) - if type(types) == 'table' then - return table.concat(types, '|') - else - return types or 'any' - end -end - -local function asLibrary(source, oop) - if not source.args then - return '' - end - local start = 1 - local methodDef - local parent = source.parent - if parent and parent.type == 'setmethod' then - methodDef = true - end - if not methodDef and oop then - start = 2 - end - local args = {} - local afterCount = 0 - for i = start, #source.args do - local buf = {} - local arg = source.args[i] - local name = arg.name - if arg.optional then - if i == start then - buf[#buf+1] = '[' - else - buf[#buf+1] = ' [' - end - end - if i > start then - buf[#buf+1] = ', ' - end - if name then - buf[#buf+1] = ('%s: %s'):format(name, mergeTypesInLibrary(arg.type)) - else - buf[#buf+1] = ('%s'):format(mergeTypesInLibrary(arg.type)) - end - if arg.optional == 'after' then - afterCount = afterCount + 1 - elseif arg.optional == 'self' then - buf[#buf+1] = ']' - end - if i == #source.args and afterCount > 0 then - buf[#buf+1] = (']'):rep(afterCount) - end - args[#args+1] = table.concat(buf) - end - return table.concat(args) -end - local function optionalArg(arg) if not arg.bindDocs then return false @@ -116,11 +61,6 @@ local function asDocFunction(source) end return function (source, oop) - if source.type == 'library' then - return asLibrary(source.value, oop) - elseif source.library then - return asLibrary(source, oop) - end if source.type == 'function' then return asFunction(source, oop) end |