summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-08 19:29:40 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-08 19:29:40 +0800
commitf76813d8a2e4ae3204b549259fe714806807e03d (patch)
tree2386f6a295cedc9de5544455f904a4f1d97e64db /server/src
parent4fcc1fda1276fad2daf6c09e2ffddc8c01206aae (diff)
downloadlua-language-server-f76813d8a2e4ae3204b549259fe714806807e03d.zip
修正找lib的一个bug
Diffstat (limited to 'server/src')
-rw-r--r--server/src/matcher/find_lib.lua20
1 files changed, 10 insertions, 10 deletions
diff --git a/server/src/matcher/find_lib.lua b/server/src/matcher/find_lib.lua
index 3d98aef7..f24dabd4 100644
--- a/server/src/matcher/find_lib.lua
+++ b/server/src/matcher/find_lib.lua
@@ -179,9 +179,6 @@ local function checkParentAsObject(parentValue, name, parent)
end
local function checkParent(value, name, lib)
- if not lib.parent then
- return nil
- end
if name ~= value.key then
return nil
end
@@ -214,13 +211,16 @@ end
local function findLib(var, libs)
local value = var.value or var
for libname, lib in pairs(libs) do
- local fullKey = checkSource(value, libname, lib)
- if fullKey then
- return lib, fullKey, false
- end
- local fullKey, oo = checkParent(value, libname, lib)
- if fullKey then
- return lib, fullKey, oo
+ if lib.parent then
+ local fullKey, oo = checkParent(value, libname, lib)
+ if fullKey then
+ return lib, fullKey, oo
+ end
+ else
+ local fullKey = checkSource(value, libname, lib)
+ if fullKey then
+ return lib, fullKey, false
+ end
end
end
return nil, nil, nil