summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/core/definition.lua10
-rw-r--r--server/src/vm/function.lua1
-rw-r--r--server/test/crossfile/definition.lua26
3 files changed, 31 insertions, 6 deletions
diff --git a/server/src/core/definition.lua b/server/src/core/definition.lua
index e240e614..341a363f 100644
--- a/server/src/core/definition.lua
+++ b/server/src/core/definition.lua
@@ -93,12 +93,20 @@ local function parseValueCrossFile(vm, source, lsp)
end
local function parseLocal(vm, source, lsp)
+ local positions = {}
local loc = source:bindLocal()
+ if loc:get 'arg' then
+ positions[#positions+1] = {
+ loc:get 'arg'.start,
+ loc:get 'arg'.finish,
+ loc:get 'arg':getUri(),
+ }
+ return positions
+ end
local value = source:bindValue()
if value.uri ~= '' and value.uri ~= vm.uri then
return parseValueCrossFile(vm, source, lsp)
end
- local positions = {}
positions[#positions+1] = {
loc:getSource().start,
loc:getSource().finish,
diff --git a/server/src/vm/function.lua b/server/src/vm/function.lua
index 973f984e..0c13b840 100644
--- a/server/src/vm/function.lua
+++ b/server/src/vm/function.lua
@@ -196,6 +196,7 @@ function mt:createArg(vm, arg)
arg:set('arg', true)
if arg.type == 'name' then
local loc = createLocal(arg[1], arg, createValue('nil', arg))
+ loc:set('arg', arg)
self:saveLocal(arg[1], loc)
self.args[#self.args+1] = loc
elseif arg.type == '...' then
diff --git a/server/test/crossfile/definition.lua b/server/test/crossfile/definition.lua
index 4a444615..b824c9dc 100644
--- a/server/test/crossfile/definition.lua
+++ b/server/test/crossfile/definition.lua
@@ -40,19 +40,16 @@ function TEST(datas)
targetList = list[1]
end
targetUri = uri
- lsp:saveText(uri, 1, new)
- goto CONTINUE
+ data.content = new
end
new, list = catch_target(data.content, '?')
if new ~= data.content then
compiled[i] = new
sourceList = list
sourceUri = uri
- lsp:saveText(uri, 1, new)
- goto CONTINUE
+ data.content = new
end
lsp:saveText(uri, 1, data.content)
- ::CONTINUE::
ws:addFile(uri)
end
@@ -230,3 +227,22 @@ TEST {
]]
}
}
+
+TEST {
+ {
+ path = 'a.lua',
+ content = [[
+ return function (<!arg!>)
+ print(<?arg?>)
+ end
+ ]],
+ },
+ {
+ path = 'b.lua',
+ content = [[
+ local f = require 'a'
+ local v = 1
+ f(v)
+ ]],
+ },
+}