blob: 2fd7aaec7dda8b644f65ff67ae14a3d593999812 (
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
|
local parser = require 'parser'
local matcher = require 'matcher'
return function (lsp, params)
local uri = params.textDocument.uri
local results, lines = lsp:loadText(uri)
if not results then
return nil
end
-- lua是从1开始的,因此都要+1
local position = lines:position(params.position.line + 1, params.position.character + 1, 'utf8')
local text, kind = matcher.hover(results, position)
if not text then
return nil
end
local response = {
contents = {
value = text,
kind = kind,
}
}
return response
end
|