summaryrefslogtreecommitdiff
path: root/server/src/matcher/vm.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-20 18:21:59 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-20 18:21:59 +0800
commit9a86f72c6cc23a0f685acdf6df7103981e7d3c44 (patch)
treeb1f06fe7488e730befba83ffa0ec7bff5144211a /server/src/matcher/vm.lua
parent0cb5fa988d6030f926781ddb3facfd18df00ec14 (diff)
downloadlua-language-server-9a86f72c6cc23a0f685acdf6df7103981e7d3c44.zip
应该要复制出来遍历
Diffstat (limited to 'server/src/matcher/vm.lua')
-rw-r--r--server/src/matcher/vm.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/server/src/matcher/vm.lua b/server/src/matcher/vm.lua
index 13a04e87..eafe892c 100644
--- a/server/src/matcher/vm.lua
+++ b/server/src/matcher/vm.lua
@@ -1189,8 +1189,12 @@ function mt:loadRequires()
if not self.lsp or not self.lsp.workspace then
return
end
- for value, str in pairs(self.requires) do
- self.requires[value] = nil
+ local copy = {}
+ for k, v in pairs(self.requires) do
+ self.requires[k] = nil
+ copy[k] = v
+ end
+ for value, str in pairs(copy) do
if type(str) == 'string' then
local uri = self.lsp.workspace:searchPath(str)
-- 如果循环require,这里会返回nil