blob: cf99aebce83e801c03174a44a71f1eeb3e085252 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
local lclient = require 'lclient'
local ws = require 'workspace'
local await = require 'await'
---@async
lclient():start(function (client)
client:registerFakers()
client:initialize()
client:notify('textDocument/didOpen', {
textDocument = {
uri = 'file://test.lua',
languageId = 'lua',
version = 0,
text = [[
---@class Class
local m
---@return Class
function m:f() end
---@type Class
local v
v = v:f()
]]
}
})
ws.awaitReady()
await.sleep(0.1)
local hover1 = client:awaitRequest('textDocument/hover', {
textDocument = { uri = 'file://test.lua' },
position = { line = 7, character = 6 },
})
local hover2 = client:awaitRequest('textDocument/hover', {
textDocument = { uri = 'file://test.lua' },
position = { line = 8, character = 0 },
})
assert(hover1.contents.value:find 'Class')
assert(hover2.contents.value:find 'Class')
end)
|