summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-09-22 19:34:29 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-09-22 19:34:29 +0800
commitf57367d3bcdc7229d1d9b3125f6fd4c60342ca50 (patch)
tree1350eb61d87542668fb17c62a5af11d05f075c6e /script/core
parentc951f3472628bdccdbf13a6bd95bc36cc93523fd (diff)
downloadlua-language-server-f57367d3bcdc7229d1d9b3125f6fd4c60342ca50.zip
fix
Diffstat (limited to 'script/core')
-rw-r--r--script/core/diagnostics/undefined-global.lua2
-rw-r--r--script/core/noder.lua21
2 files changed, 18 insertions, 5 deletions
diff --git a/script/core/diagnostics/undefined-global.lua b/script/core/diagnostics/undefined-global.lua
index c7ddeac2..14754c16 100644
--- a/script/core/diagnostics/undefined-global.lua
+++ b/script/core/diagnostics/undefined-global.lua
@@ -5,6 +5,7 @@ local config = require 'config'
local guide = require 'parser.guide'
local noder = require 'core.noder'
local collector = require 'core.collector'
+local await = require 'await'
local requireLike = {
['include'] = true,
@@ -35,6 +36,7 @@ return function (uri, callback)
if node.tag ~= '_ENV' then
return
end
+ await.delay()
local id = 'def:' .. noder.getID(src)
if not collector.has(id) then
local message = lang.script('DIAG_UNDEF_GLOBAL', key)
diff --git a/script/core/noder.lua b/script/core/noder.lua
index d6069833..1107dcda 100644
--- a/script/core/noder.lua
+++ b/script/core/noder.lua
@@ -1583,11 +1583,6 @@ local partNodersMap = util.switch()
m.compilePartNodes(noders, ref)
end
end
-
- local nxt = source.next
- if nxt then
- m.compilePartNodes(noders, nxt)
- end
end)
: case 'setlocal'
: case 'getlocal'
@@ -1603,6 +1598,14 @@ local partNodersMap = util.switch()
if parent.value == source then
m.compilePartNodes(noders, parent)
end
+
+ if parent.type == 'call' then
+ local node = parent.node
+ if node.special == 'rawset'
+ or node.special == 'rawget' then
+ m.compilePartNodes(noders, parent)
+ end
+ end
end)
: case 'setfield'
: case 'getfield'
@@ -1634,6 +1637,14 @@ local partNodersMap = util.switch()
if parent.value == source then
m.compilePartNodes(noders, parent)
end
+
+ if parent.type == 'call' then
+ local node = parent.node
+ if node.special == 'rawset'
+ or node.special == 'rawget' then
+ m.compilePartNodes(noders, parent)
+ end
+ end
end)
: case 'label'
: call(function (noders, source)