summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-06 15:58:42 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-06 15:58:42 +0800
commit3dacfb961183813bcdf63a51851efbe1ebd12641 (patch)
treeee435aaee31ab612b4dd6a10c8a92a3d79b81e41
parent9a548bbdcfaec6d0d438e447d4f8699ab9b12f19 (diff)
downloadlua-language-server-3dacfb961183813bcdf63a51851efbe1ebd12641.zip
重定义过滤2个名字
-rw-r--r--server/src/matcher/compile.lua2
-rw-r--r--server/src/matcher/diagnostics.lua5
2 files changed, 6 insertions, 1 deletions
diff --git a/server/src/matcher/compile.lua b/server/src/matcher/compile.lua
index 9e2da220..a8cf623b 100644
--- a/server/src/matcher/compile.lua
+++ b/server/src/matcher/compile.lua
@@ -116,7 +116,7 @@ function mt:searchCall(call, simple, i)
for i, exp in ipairs(call) do
results[i] = self:searchExp(exp)
end
-
+
-- 特殊处理 setmetatable
if i == 2 and simple[1][1] == 'setmetatable' then
local obj = results[1]
diff --git a/server/src/matcher/diagnostics.lua b/server/src/matcher/diagnostics.lua
index e53b4c1d..cce5b196 100644
--- a/server/src/matcher/diagnostics.lua
+++ b/server/src/matcher/diagnostics.lua
@@ -96,6 +96,11 @@ local function searchRedefinition(results, callback)
if var.type ~= 'local' then
goto NEXT_VAR
end
+ if var.key == '_'
+ or var.key == '_ENV'
+ then
+ goto NEXT_VAR
+ end
local shadow = var.redefinition
if not shadow then
goto NEXT_VAR