summaryrefslogtreecommitdiff
path: root/server/test/crossfile
diff options
context:
space:
mode:
Diffstat (limited to 'server/test/crossfile')
-rw-r--r--server/test/crossfile/definition.lua10
-rw-r--r--server/test/crossfile/hover.lua28
2 files changed, 33 insertions, 5 deletions
diff --git a/server/test/crossfile/definition.lua b/server/test/crossfile/definition.lua
index 43261771..11d5f746 100644
--- a/server/test/crossfile/definition.lua
+++ b/server/test/crossfile/definition.lua
@@ -38,14 +38,14 @@ function TEST(data)
local sourceScript, sourceList = catch_target(data[2].content, '?')
local sourceUri = ws:uriEncode(fs.path(data[2].path))
- lsp:saveText(targetUri, 1, targetScript)
lsp:saveText(sourceUri, 1, sourceScript)
- ws:addFile(targetUri)
ws:addFile(sourceUri)
- lsp:compileVM(targetUri)
- lsp:compileVM(sourceUri)
+ lsp:saveText(targetUri, 1, targetScript)
+ ws:addFile(targetUri)
+ lsp:compileAll()
+ lsp:compileAll()
- local sourceVM = lsp:loadVM(sourceUri)
+ local sourceVM = lsp:getVM(sourceUri)
assert(sourceVM)
local sourcePos = (sourceList[1][1] + sourceList[1][2]) // 2
local positions = matcher.definition(sourceVM, sourcePos)
diff --git a/server/test/crossfile/hover.lua b/server/test/crossfile/hover.lua
index 8bcc9411..51ac85bd 100644
--- a/server/test/crossfile/hover.lua
+++ b/server/test/crossfile/hover.lua
@@ -135,3 +135,31 @@ TEST {
label = 'function (a: any, b: any)',
}
}
+
+TEST {
+ {
+ path = 'a.lua',
+ content = [[
+ local mt = {}
+ mt.__index = mt
+
+ function mt:add(a, b)
+ end
+
+ return function ()
+ return setmetatable({}, mt)
+ end
+ ]],
+ },
+ {
+ path = 'b.lua',
+ content = [[
+ local m = require 'a'
+ local obj = m()
+ obj:<?add?>()
+ ]]
+ },
+ hover = {
+ label = 'function mt:add(a: any, b: any)'
+ },
+}