From d1ca1c8add2b122eb9b558d3c185f34de001e971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 9 Dec 2019 17:29:00 +0800 Subject: =?UTF-8?q?hover=20=E6=94=AF=E6=8C=81=20require=20=E8=B7=AF?= =?UTF-8?q?=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script-beta/core/definition.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'script-beta/core/definition.lua') diff --git a/script-beta/core/definition.lua b/script-beta/core/definition.lua index 865fc7cb..5f16ad84 100644 --- a/script-beta/core/definition.lua +++ b/script-beta/core/definition.lua @@ -58,14 +58,17 @@ local function checkRequire(source, offset, callback) if type(literal) ~= 'string' then return end - local name = func.special - if name == 'require' then + local lib = vm.getLibrary(func) + if not lib then + return + end + if lib.name == 'require' then local result = workspace.findUrisByRequirePath(literal, true) for _, uri in ipairs(result) do callback(uri) end - elseif name == 'dofile' - or name == 'loadfile' then + elseif lib.name == 'dofile' + or lib.name == 'loadfile' then local result = workspace.findUrisByFilePath(literal, true) for _, uri in ipairs(result) do callback(uri) -- cgit v1.2.3