summaryrefslogtreecommitdiff
path: root/script/core/hover
diff options
context:
space:
mode:
Diffstat (limited to 'script/core/hover')
-rw-r--r--script/core/hover/args.lua10
-rw-r--r--script/core/hover/description.lua2
-rw-r--r--script/core/hover/init.lua2
-rw-r--r--script/core/hover/label.lua6
-rw-r--r--script/core/hover/return.lua5
-rw-r--r--script/core/hover/table.lua6
6 files changed, 16 insertions, 15 deletions
diff --git a/script/core/hover/args.lua b/script/core/hover/args.lua
index c485d9b9..21e7c00f 100644
--- a/script/core/hover/args.lua
+++ b/script/core/hover/args.lua
@@ -9,7 +9,7 @@ local function asFunction(source)
methodDef = true
end
if methodDef then
- args[#args+1] = ('self: %s'):format(vm.getInfer(parent.node):view 'any')
+ args[#args+1] = ('self: %s'):format(vm.getInfer(parent.node):view(guide.getUri(source), 'any'))
end
if source.args then
for i = 1, #source.args do
@@ -29,15 +29,15 @@ local function asFunction(source)
args[#args+1] = ('%s%s: %s'):format(
name,
optional and '?' or '',
- vm.getInfer(argNode):view('any', guide.getUri(source))
+ vm.getInfer(argNode):view(guide.getUri(source), 'any')
)
elseif arg.type == '...' then
args[#args+1] = ('%s: %s'):format(
'...',
- vm.getInfer(arg):view 'any'
+ vm.getInfer(arg):view(guide.getUri(source), 'any')
)
else
- args[#args+1] = ('%s'):format(vm.getInfer(arg):view 'any')
+ args[#args+1] = ('%s'):format(vm.getInfer(arg):view(guide.getUri(source), 'any'))
end
::CONTINUE::
end
@@ -56,7 +56,7 @@ local function asDocFunction(source)
args[i] = ('%s%s: %s'):format(
name,
arg.optional and '?' or '',
- arg.extends and vm.getInfer(arg.extends):view 'any' or 'any'
+ arg.extends and vm.getInfer(arg.extends):view(guide.getUri(source), 'any') or 'any'
)
end
return args
diff --git a/script/core/hover/description.lua b/script/core/hover/description.lua
index 712ea1ad..e3c3f412 100644
--- a/script/core/hover/description.lua
+++ b/script/core/hover/description.lua
@@ -152,7 +152,7 @@ local function buildEnumChunk(docType, name)
local types = {}
local lines = {}
for _, tp in ipairs(vm.getDefs(docType)) do
- types[#types+1] = vm.getInfer(tp):view()
+ types[#types+1] = vm.getInfer(tp):view(guide.getUri(docType))
if tp.type == 'doc.type.string'
or tp.type == 'doc.type.integer'
or tp.type == 'doc.type.boolean' then
diff --git a/script/core/hover/init.lua b/script/core/hover/init.lua
index 7231944a..949156aa 100644
--- a/script/core/hover/init.lua
+++ b/script/core/hover/init.lua
@@ -39,7 +39,7 @@ local function getHover(source)
end
local oop
- if vm.getInfer(source):view() == 'function' then
+ if vm.getInfer(source):view(guide.getUri(source)) == 'function' then
local defs = vm.getDefs(source)
-- make sure `function` is before `doc.type.function`
local orders = {}
diff --git a/script/core/hover/label.lua b/script/core/hover/label.lua
index 2bbfe806..e725f6b0 100644
--- a/script/core/hover/label.lua
+++ b/script/core/hover/label.lua
@@ -33,7 +33,7 @@ local function asDocTypeName(source)
return '(class) ' .. doc.class[1]
end
if doc.type == 'doc.alias' then
- return '(alias) ' .. doc.alias[1] .. ' ' .. lang.script('HOVER_EXTENDS', vm.getInfer(doc.extends):view())
+ return '(alias) ' .. doc.alias[1] .. ' ' .. lang.script('HOVER_EXTENDS', vm.getInfer(doc.extends):view(guide.getUri(source)))
end
end
end
@@ -42,7 +42,7 @@ end
local function asValue(source, title)
local name = buildName(source, false) or ''
local ifr = vm.getInfer(source)
- local type = ifr:view()
+ local type = ifr:view(guide.getUri(source))
local literal = ifr:viewLiterals()
local cont = buildTable(source)
local pack = {}
@@ -139,7 +139,7 @@ local function asDocFieldName(source)
break
end
end
- local view = vm.getInfer(source.extends):view()
+ local view = vm.getInfer(source.extends):view(guide.getUri(source))
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 3d8a94a5..2ee234b6 100644
--- a/script/core/hover/return.lua
+++ b/script/core/hover/return.lua
@@ -1,4 +1,5 @@
local vm = require 'vm.vm'
+local guide = require 'parser.guide'
---@param source parser.object
---@return integer
@@ -65,7 +66,7 @@ local function asFunction(source)
local name = doc and doc.name and doc.name[1] and (doc.name[1] .. ': ')
local text = ('%s%s'):format(
name or '',
- vm.getInfer(rtn):view()
+ vm.getInfer(rtn):view(guide.getUri(source))
)
if i == 1 then
returns[i] = (' -> %s'):format(text)
@@ -83,7 +84,7 @@ local function asDocFunction(source)
end
local returns = {}
for i, rtn in ipairs(source.returns) do
- local rtnText = vm.getInfer(rtn):view()
+ local rtnText = vm.getInfer(rtn):view(guide.getUri(source))
if i == 1 then
returns[#returns+1] = (' -> %s'):format(rtnText)
else
diff --git a/script/core/hover/table.lua b/script/core/hover/table.lua
index 16874101..97ace24e 100644
--- a/script/core/hover/table.lua
+++ b/script/core/hover/table.lua
@@ -30,7 +30,7 @@ local function buildAsHash(uri, keys, nodeMap, reachMax)
node:removeOptional()
end
local ifr = vm.getInfer(node)
- local typeView = ifr:view('unknown', uri)
+ local typeView = ifr:view(uri, 'unknown')
local literalView = ifr:viewLiterals()
if literalView then
lines[#lines+1] = (' %s%s: %s = %s,'):format(
@@ -75,7 +75,7 @@ local function buildAsConst(uri, keys, nodeMap, reachMax)
node = node:copy()
node:removeOptional()
end
- local typeView = vm.getInfer(node):view('unknown', uri)
+ local typeView = vm.getInfer(node):view(uri, 'unknown')
local literalView = literalMap[key]
if literalView then
lines[#lines+1] = (' %s%s: %s = %s,'):format(
@@ -178,7 +178,7 @@ return function (source)
return nil
end
- for view in vm.getInfer(source):eachView() do
+ for view in vm.getInfer(source):eachView(uri) do
if view == 'string'
or vm.isSubType(uri, view, 'string') then
return nil