diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-12-09 17:29:00 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-12-09 17:29:00 +0800 |
commit | d1ca1c8add2b122eb9b558d3c185f34de001e971 (patch) | |
tree | 4abcdbf6f8034ae80b2d376c36fcb01ea340f7ff /script-beta/core/definition.lua | |
parent | b40b95f5aaba8da1aedbcfdea184ab7ba109c5a8 (diff) | |
download | lua-language-server-d1ca1c8add2b122eb9b558d3c185f34de001e971.zip |
hover 支持 require 路径
Diffstat (limited to 'script-beta/core/definition.lua')
-rw-r--r-- | script-beta/core/definition.lua | 11 |
1 files changed, 7 insertions, 4 deletions
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) |