summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-03-22 17:42:42 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-03-22 17:42:42 +0800
commitc1dc77aed3f0a73db63d0eb33b30f726a07d8122 (patch)
tree03ec77767c13f86763e463d83fc5c2104e6e85ec
parent2bdca100e37eef6a5fcaacd1cf7157352afb0777 (diff)
downloadlua-language-server-c1dc77aed3f0a73db63d0eb33b30f726a07d8122.zip
修正一个bug
-rw-r--r--server/src/vm/vm.lua1
-rw-r--r--server/test/crossfile/completion.lua18
2 files changed, 19 insertions, 0 deletions
diff --git a/server/src/vm/vm.lua b/server/src/vm/vm.lua
index 2049fe03..7deadf4a 100644
--- a/server/src/vm/vm.lua
+++ b/server/src/vm/vm.lua
@@ -230,6 +230,7 @@ function mt:callRequire(func, values)
local lib = library.library[str]
if lib then
local value = libraryBuilder.value(lib)
+ value:markGlobal()
func:setReturn(1, value)
return
else
diff --git a/server/test/crossfile/completion.lua b/server/test/crossfile/completion.lua
index b93e6ba8..eaa5ef00 100644
--- a/server/test/crossfile/completion.lua
+++ b/server/test/crossfile/completion.lua
@@ -409,3 +409,21 @@ TEST {
},
}
}
+
+TEST {
+ {
+ path = 'a.lua',
+ content = [[
+ local japi = require 'jass.japi'
+ japi.xxxaaaaxxxx
+ ]]
+ },
+ {
+ path = 'a.lua',
+ content = [[
+ local japi = require 'jass.japi'
+ japi.xxxaaaax@
+ ]],
+ main = true,
+ },
+}