summaryrefslogtreecommitdiff
path: root/script/core/diagnostics/undefined-env-child.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-11 20:34:02 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-11 20:34:02 +0800
commit8f056d36ec61dd91cfab282780dc1786df646fcb (patch)
treee81ec976ad922c4bc74dedf29548f2a7c322f68e /script/core/diagnostics/undefined-env-child.lua
parent3820962ca2d23d525bc8417c8088e7eeb667cba1 (diff)
downloadlua-language-server-8f056d36ec61dd91cfab282780dc1786df646fcb.zip
Revert "resolve #1209"
This reverts commit 3820962ca2d23d525bc8417c8088e7eeb667cba1.
Diffstat (limited to 'script/core/diagnostics/undefined-env-child.lua')
-rw-r--r--script/core/diagnostics/undefined-env-child.lua32
1 files changed, 6 insertions, 26 deletions
diff --git a/script/core/diagnostics/undefined-env-child.lua b/script/core/diagnostics/undefined-env-child.lua
index 1dff575b..2f559697 100644
--- a/script/core/diagnostics/undefined-env-child.lua
+++ b/script/core/diagnostics/undefined-env-child.lua
@@ -3,40 +3,20 @@ local guide = require 'parser.guide'
local lang = require 'language'
local vm = require "vm.vm"
----@param source parser.object
----@return boolean
-local function isBindDoc(source)
- if not source.bindDocs then
- return false
- end
- for _, doc in ipairs(source.bindDocs) do
- if doc.type == 'doc.type'
- or doc.type == 'doc.class' then
- return true
- end
- end
- return false
-end
-
return function (uri, callback)
- local state = files.getState(uri)
- if not state then
+ local ast = files.getState(uri)
+ if not ast then
return
end
-
- guide.eachSourceType(state.ast, 'getglobal', function (source)
+ guide.eachSourceType(ast.ast, 'getglobal', function (source)
+ -- 单独验证自己是否在重载过的 _ENV 中有定义
if source.node.tag == '_ENV' then
return
end
-
- if not isBindDoc(source.node) then
+ local defs = vm.getDefs(source)
+ if #defs > 0 then
return
end
-
- if #vm.getDefs(source) > 0 then
- return
- end
-
local key = source[1]
callback {
start = source.start,