summaryrefslogtreecommitdiff
path: root/test/tclient/tests/recursive-runner.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-11-18 17:47:11 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-11-18 17:47:11 +0800
commitb137f3faf9225e4e4279e0aefc1d98bfb6aa4724 (patch)
treee0044497742e14bddb0f6f4e54163319a040cd86 /test/tclient/tests/recursive-runner.lua
parente13503e871ade8422e5a44d5c582f05769fe8dde (diff)
downloadlua-language-server-b137f3faf9225e4e4279e0aefc1d98bfb6aa4724.zip
resolve dead lock
Diffstat (limited to 'test/tclient/tests/recursive-runner.lua')
-rw-r--r--test/tclient/tests/recursive-runner.lua42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/tclient/tests/recursive-runner.lua b/test/tclient/tests/recursive-runner.lua
index 3e3b5bba..5ecae705 100644
--- a/test/tclient/tests/recursive-runner.lua
+++ b/test/tclient/tests/recursive-runner.lua
@@ -118,5 +118,47 @@ y = x
assert(hover6.contents.value:find 'number')
assert(hover7.contents.value:find 'number')
+ client:notify('textDocument/didOpen', {
+ textDocument = {
+ uri = 'file://test.lua',
+ languageId = 'lua',
+ version = 2,
+ text = [[
+---@meta
+
+---@class vector3
+---@operator add(vector3): vector3
+---@operator sub(vector3): vector3
+---@operator mul(vector3): number
+---@operator mul(number): vector3
+---@operator div(number): vector3
+local mt
+
+---@return vector3
+function mt:normalize() end
+
+---@param target vector3
+function Walk(target)
+ local moveSpeed = 1.0
+ local deltalTime = 2.0
+
+ ---@type vector3
+ local curPos
+ local targetDirVec = (target - curPos):normalize()
+ local stepMove = targetDirVec * (moveSpeed * deltalTime)
+ local nextPos = curPos + stepMove
+
+ curPos = nextPos
+end
+]]
+ }
+ })
+
+ local hover1 = client:awaitRequest('textDocument/hover', {
+ textDocument = { uri = 'file://test.lua' },
+ position = { line = 20, character = 11 },
+ })
+ assert(hover1.contents.value:find 'vector3')
+
config.set(nil, 'Lua.diagnostics.enable', true)
end)