summaryrefslogtreecommitdiff
path: root/script/core/hover
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-03-31 23:00:02 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-03-31 23:00:02 +0800
commitc1ca4d8af0cefd6222b76f83341774857cef44ec (patch)
tree135a6c44cee6e253a20dd33c78e5c85db3eb6495 /script/core/hover
parent3e516dd717440cad6fce8731a2b627abc6335bbb (diff)
downloadlua-language-server-c1ca4d8af0cefd6222b76f83341774857cef44ec.zip
cleanup
Diffstat (limited to 'script/core/hover')
-rw-r--r--script/core/hover/arg.lua10
-rw-r--r--script/core/hover/init.lua2
-rw-r--r--script/core/hover/label.lua10
-rw-r--r--script/core/hover/return.lua4
4 files changed, 13 insertions, 13 deletions
diff --git a/script/core/hover/arg.lua b/script/core/hover/arg.lua
index c9c81a85..7611a895 100644
--- a/script/core/hover/arg.lua
+++ b/script/core/hover/arg.lua
@@ -21,7 +21,7 @@ local function asFunction(source, oop)
methodDef = true
end
if methodDef then
- args[#args+1] = ('self: %s'):format(infer.viewType(parent.node))
+ args[#args+1] = ('self: %s'):format(infer.getInfer(parent.node))
end
if source.args then
for i = 1, #source.args do
@@ -34,15 +34,15 @@ local function asFunction(source, oop)
args[#args+1] = ('%s%s: %s'):format(
name,
optionalArg(arg) and '?' or '',
- infer.viewType(arg, 'any')
+ infer.getInfer(arg):view 'any'
)
elseif arg.type == '...' then
args[#args+1] = ('%s: %s'):format(
'...',
- infer.viewType(arg, 'any')
+ infer.getInfer(arg):view 'any'
)
else
- args[#args+1] = ('%s'):format(infer.viewType(arg, 'any'))
+ args[#args+1] = ('%s'):format(infer.getInfer(arg):view 'any')
end
::CONTINUE::
end
@@ -65,7 +65,7 @@ local function asDocFunction(source, oop)
args[i] = ('%s%s: %s'):format(
name,
arg.optional and '?' or '',
- arg.extends and infer.viewType(arg.extends) or 'any'
+ arg.extends and infer.getInfer(arg.extends):view 'any' or 'any'
)
end
if oop then
diff --git a/script/core/hover/init.lua b/script/core/hover/init.lua
index fdfbd73d..bc2f40eb 100644
--- a/script/core/hover/init.lua
+++ b/script/core/hover/init.lua
@@ -40,7 +40,7 @@ local function getHover(source)
end
local oop
- if infer.viewType(source) == 'function' then
+ if infer.getInfer(source):view() == 'function' then
local hasFunc
for _, def in ipairs(vm.getDefs(source)) do
if guide.isOOP(def) then
diff --git a/script/core/hover/label.lua b/script/core/hover/label.lua
index 01dd1143..150f0f24 100644
--- a/script/core/hover/label.lua
+++ b/script/core/hover/label.lua
@@ -35,7 +35,7 @@ local function asDocTypeName(source)
end
if doc.type == 'doc.alias.name' then
local extends = doc.parent.extends
- return lang.script('HOVER_EXTENDS', infer.viewType(extends))
+ return lang.script('HOVER_EXTENDS', infer.getInfer(extends):view())
end
end
end
@@ -43,12 +43,12 @@ end
---@async
local function asValue(source, title)
local name = buildName(source, false) or ''
- local type = infer.viewType(source)
+ local type = infer.getInfer(source):view()
local literal = infer.viewLiterals(source)
local cont
- if not infer.hasType(source, 'string')
+ if not infer.getInfer(source):hasType 'string'
and not type:find('%[%]$') then
- if infer.hasType(source, 'table') then
+ if infer.getInfer(source):hasType 'table' then
cont = buildTable(source)
end
end
@@ -131,7 +131,7 @@ local function asDocFieldName(source)
break
end
end
- local view = infer.viewType(docField.extends)
+ local view = infer.getInfer(docField.extends):view()
if not class then
return ('field ?.%s: %s'):format(name, view)
end
diff --git a/script/core/hover/return.lua b/script/core/hover/return.lua
index e48febf3..cb8fa76f 100644
--- a/script/core/hover/return.lua
+++ b/script/core/hover/return.lua
@@ -67,7 +67,7 @@ local function asFunction(source)
local name = doc and doc.name and doc.name[1] and (doc.name[1] .. ': ')
local text = ('%s%s%s'):format(
name or '',
- infer.viewType(rtn),
+ infer.getInfer(rtn):view(),
doc and doc.optional and '?' or ''
)
if i == 1 then
@@ -87,7 +87,7 @@ local function asDocFunction(source)
local returns = {}
for i, rtn in ipairs(source.returns) do
local rtnText = ('%s%s'):format(
- infer.viewType(rtn),
+ infer.getInfer(rtn):view(),
rtn.optional and '?' or ''
)
if i == 1 then