summaryrefslogtreecommitdiff
path: root/test/crossfile/hover.lua
diff options
context:
space:
mode:
authorjefersonf <jeferson.silva>2021-10-30 13:19:12 -0300
committerjefersonf <jeferson.silva>2021-10-30 13:19:12 -0300
commitf0c5bbeb62794116b6517be51efa6054254076eb (patch)
treefee585182a7ec10e987e758a53edcbd7db9dca9b /test/crossfile/hover.lua
parentf41a33de696dc5ff802d2f5e540da1c87861dac9 (diff)
parent107b57cc7728824a0e9515727f9a6123c5f7c902 (diff)
downloadlua-language-server-f0c5bbeb62794116b6517be51efa6054254076eb.zip
Merge branch 'master' of https://github.com/sumneko/lua-language-server into pt-br-locale-support
Diffstat (limited to 'test/crossfile/hover.lua')
-rw-r--r--test/crossfile/hover.lua35
1 files changed, 34 insertions, 1 deletions
diff --git a/test/crossfile/hover.lua b/test/crossfile/hover.lua
index b1c4c804..35528446 100644
--- a/test/crossfile/hover.lua
+++ b/test/crossfile/hover.lua
@@ -40,7 +40,7 @@ end
function TEST(expect)
files.removeAll()
- local targetScript = expect[1].content
+ local targetScript, targetList = catch(expect[1].content, '?')
local targetUri = furi.encode(expect[1].path)
local sourceScript, sourceList = catch(expect[2].content, '?')
@@ -49,6 +49,10 @@ function TEST(expect)
files.setText(targetUri, targetScript)
files.setText(sourceUri, sourceScript)
+ if targetList['?'] then
+ local targetPos = (targetList['?'][1][1] + targetList['?'][1][2]) // 2
+ core.byUri(targetUri, targetPos)
+ end
local sourcePos = (sourceList['?'][1][1] + sourceList['?'][1][2]) // 2
local hover = core.byUri(sourceUri, sourcePos)
assert(hover)
@@ -1018,3 +1022,32 @@ function fn()
line1
line2]]}
+
+TEST {
+ {
+ path = 'a.lua',
+ content = [[
+---@type string[]
+local ss
+
+for _, s in ipairs(ss) do
+ print(<?s?>)
+end
+]],
+ },
+ {
+ path = 'b.lua',
+ content = [[
+
+
+
+for _, x in ipairs({} and {}) do
+ print(<?x?>) -- `x` is infered as `string`
+end
+]],
+ },
+ hover = [[
+```lua
+local x: any
+```]]
+}