diff options
Diffstat (limited to 'script/core')
-rw-r--r-- | script/core/completion/completion.lua | 4 | ||||
-rw-r--r-- | script/core/diagnostics/type-check.lua | 8 | ||||
-rw-r--r-- | script/core/hover/arg.lua | 6 | ||||
-rw-r--r-- | script/core/hover/return.lua | 3 | ||||
-rw-r--r-- | script/core/semantic-tokens.lua | 2 |
5 files changed, 12 insertions, 11 deletions
diff --git a/script/core/completion/completion.lua b/script/core/completion/completion.lua index e7633e7c..f54bd2d1 100644 --- a/script/core/completion/completion.lua +++ b/script/core/completion/completion.lua @@ -1105,7 +1105,7 @@ end local function checkTypingEnum(state, position, defs, str, results) local enums = {} for _, def in ipairs(defs) do - if def.type == 'doc.type.enum' + if def.type == 'doc.type.string' or def.type == 'doc.resume' then enums[#enums+1] = { label = def[1], @@ -1315,7 +1315,7 @@ end local function pushCallEnumsAndFuncs(defs) local results = {} for _, def in ipairs(defs) do - if def.type == 'doc.type.enum' + if def.type == 'doc.type.string' or def.type == 'doc.resume' then results[#results+1] = { label = def[1], diff --git a/script/core/diagnostics/type-check.lua b/script/core/diagnostics/type-check.lua index cbdb40a1..ebfffea0 100644 --- a/script/core/diagnostics/type-check.lua +++ b/script/core/diagnostics/type-check.lua @@ -17,7 +17,7 @@ local typeNameMap = { ['doc.class.name'] = true, ['doc.alias.name'] = true, ['doc.type.name'] = true, - ['doc.type.enum'] = true, + ['doc.type.string'] = true, ['doc.resume'] = true, } @@ -165,7 +165,7 @@ local function getParamTypes(arg) for _, argDef in ipairs(argDefs) do if argDef.type == 'doc.class.name' or argDef.type == 'doc.type.name' - or argDef.type == 'doc.type.enum' + or argDef.type == 'doc.type.string' or argDef.type == 'doc.type.ltable' then types[#types+1] = argDef end @@ -184,7 +184,7 @@ local function getParamTypes(arg) type = 'nil' } end - elseif argDef.type == 'doc.type.enum' + elseif argDef.type == 'doc.type.string' or argDef.type == 'doc.type.ltable' then types[#types+1] = argDef ---变长参数 @@ -316,7 +316,7 @@ local function getArgsInfo(uri, callArgs) -- } -- elseif def.type == 'doc.class.name' -- or def.type == 'doc.type.name' - -- or def.type == 'doc.type.enum' + -- or def.type == 'doc.type.string' -- or def.type == 'doc.type.ltable' then -- if def[1] then -- if not types.typeMap[def[1]] then diff --git a/script/core/hover/arg.lua b/script/core/hover/arg.lua index c2c6a105..c9c81a85 100644 --- a/script/core/hover/arg.lua +++ b/script/core/hover/arg.lua @@ -34,15 +34,15 @@ local function asFunction(source, oop) args[#args+1] = ('%s%s: %s'):format( name, optionalArg(arg) and '?' or '', - infer.viewType(arg) + infer.viewType(arg, 'any') ) elseif arg.type == '...' then args[#args+1] = ('%s: %s'):format( '...', - infer.viewType(arg) + infer.viewType(arg, 'any') ) else - args[#args+1] = ('%s'):format(infer.viewType(arg)) + args[#args+1] = ('%s'):format(infer.viewType(arg, 'any')) end ::CONTINUE:: end diff --git a/script/core/hover/return.lua b/script/core/hover/return.lua index f34f364e..e48febf3 100644 --- a/script/core/hover/return.lua +++ b/script/core/hover/return.lua @@ -64,8 +64,9 @@ local function asFunction(source) for i = 1, num do local rtn = compiler.getReturnOfFunction(source, i) local doc = docs[i] + local name = doc and doc.name and doc.name[1] and (doc.name[1] .. ': ') local text = ('%s%s%s'):format( - doc and doc.name[1] or '', + name or '', infer.viewType(rtn), doc and doc.optional and '?' or '' ) diff --git a/script/core/semantic-tokens.lua b/script/core/semantic-tokens.lua index f57246d3..ec19af1a 100644 --- a/script/core/semantic-tokens.lua +++ b/script/core/semantic-tokens.lua @@ -501,7 +501,7 @@ local Care = util.switch() modifieres = define.TokenModifiers.modification, } end) - : case 'doc.type.enum' + : case 'doc.type.string' : call(function (source, options, results) if not options.annotation then return |