summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/matcher/definition.lua6
-rw-r--r--server/src/matcher/vm.lua12
-rw-r--r--server/test/crossfile/definition.lua15
3 files changed, 26 insertions, 7 deletions
diff --git a/server/src/matcher/definition.lua b/server/src/matcher/definition.lua
index 18804516..b4a19b55 100644
--- a/server/src/matcher/definition.lua
+++ b/server/src/matcher/definition.lua
@@ -22,6 +22,12 @@ local function parseResultAcrossUri(positions, vm, result)
end
end
end
+ if #positions == 0 then
+ positions[#positions+1] = {
+ 0, 0,
+ result.value.uri,
+ }
+ end
end
local function parseResult(vm, result)
diff --git a/server/src/matcher/vm.lua b/server/src/matcher/vm.lua
index fdfeeb21..2156b0e8 100644
--- a/server/src/matcher/vm.lua
+++ b/server/src/matcher/vm.lua
@@ -504,13 +504,8 @@ function mt:getRequire(strValue, destVM)
if main.returns then
mainValue = readOnly(main.returns[1])
else
- mainValue = self:createValue('boolean', {
- type = 'name',
- start = 0,
- finish = 0,
- [1] = '',
- uri = destVM.uri,
- }, true)
+ mainValue = self:createValue('boolean', nil, true)
+ mainValue.uri = destVM.uri
end
-- 支持 require 'xxx' 的转到定义
@@ -1158,6 +1153,9 @@ function mt:doReturn(action)
local value = self:getExp(exp)
if value.type == 'list' then
if i == #action then
+ if #value == 0 then
+ value[1] = self:createValue('any', exp)
+ end
for x, v in ipairs(value) do
self:addInfo(v, 'return', exp)
self:setFunctionReturn(self:getCurrentFunction(), i + x - 1, v)
diff --git a/server/test/crossfile/definition.lua b/server/test/crossfile/definition.lua
index 11d5f746..230b9ddf 100644
--- a/server/test/crossfile/definition.lua
+++ b/server/test/crossfile/definition.lua
@@ -132,3 +132,18 @@ TEST {
]],
},
}
+
+TEST {
+ {
+ path = 'a.lua',
+ content = [[
+ return <!a():b():c()!>
+ ]],
+ },
+ {
+ path = 'b.lua',
+ content = [[
+ local <?t?> = require 'a'
+ ]],
+ },
+}