summaryrefslogtreecommitdiff
path: root/script-beta
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-08-17 18:44:03 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-08-17 18:44:03 +0800
commit3e4411e10f8c0ebd10341450edd6c868866d04cb (patch)
treee086ebf19d7f4302dd90b54fbf6248d1374336e7 /script-beta
parenteb822b74afdec570e500b8e6778f8d6d30a8d98a (diff)
downloadlua-language-server-3e4411e10f8c0ebd10341450edd6c868866d04cb.zip
特殊处理getLibrary
Diffstat (limited to 'script-beta')
-rw-r--r--script-beta/core/hover/label.lua2
-rw-r--r--script-beta/vm/getLibrary.lua10
2 files changed, 7 insertions, 5 deletions
diff --git a/script-beta/core/hover/label.lua b/script-beta/core/hover/label.lua
index 4f896bc7..6b3d0988 100644
--- a/script-beta/core/hover/label.lua
+++ b/script-beta/core/hover/label.lua
@@ -26,8 +26,6 @@ local function asValue(source, title)
if vm.hasType(source, 'table') then
cont = buildTable(source)
end
- --vm.eachDef(source, function (src)
- --end)
local pack = {}
pack[#pack+1] = title
pack[#pack+1] = name .. ':'
diff --git a/script-beta/vm/getLibrary.lua b/script-beta/vm/getLibrary.lua
index 69bc3f2b..e9c3b78a 100644
--- a/script-beta/vm/getLibrary.lua
+++ b/script-beta/vm/getLibrary.lua
@@ -6,6 +6,10 @@ local function checkStdLibrary(source)
if source.library then
return source
end
+ local value = guide.getObjectValue(source)
+ if value and value.type == 'select' then
+ source = value
+ end
if source.type == 'getglobal'
or source.type == 'setglobal' then
local name = guide.getName(source)
@@ -79,8 +83,8 @@ local function checkNode(source)
end
end
-local function checkRef(source)
- local results = guide.requestReference(source)
+local function checkDef(source)
+ local results = guide.requestDefinition(source)
for _, src in ipairs(results) do
local lib = checkStdLibrary(src) or checkNode(src)
if lib then
@@ -93,7 +97,7 @@ end
local function getLibrary(source)
return checkNode(source)
or checkStdLibrary(source)
- or checkRef(source)
+ or checkDef(source)
end
function vm.getLibrary(source)