diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-19 14:57:38 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-19 14:57:38 +0800 |
commit | 2c5cfd138ace486e36960a018e39d1b9c52cabc1 (patch) | |
tree | a34318a779df76ce7d7de527ddfbdaa2a3bd425d /server/src | |
parent | b48a27f639dd08a128bcaf0eb56fb5c949da4f91 (diff) | |
download | lua-language-server-2c5cfd138ace486e36960a018e39d1b9c52cabc1.zip |
hover的result在外面算
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/matcher/hover.lua | 7 | ||||
-rw-r--r-- | server/src/method/textDocument/hover.lua | 8 |
2 files changed, 8 insertions, 7 deletions
diff --git a/server/src/matcher/hover.lua b/server/src/matcher/hover.lua index 911cf964..e5ec1918 100644 --- a/server/src/matcher/hover.lua +++ b/server/src/matcher/hover.lua @@ -360,12 +360,7 @@ local function getValueHover(name, valueType, result, source, lib) ]]):format(text, tip) end -return function (vm, pos) - local result, source = findResult(vm, pos) - if not result then - return nil - end - +return function (vm, result, source) if not result.value then return end diff --git a/server/src/method/textDocument/hover.lua b/server/src/method/textDocument/hover.lua index ea15a32a..327f91f2 100644 --- a/server/src/method/textDocument/hover.lua +++ b/server/src/method/textDocument/hover.lua @@ -8,7 +8,13 @@ return function (lsp, params) end -- lua是从1开始的,因此都要+1 local position = lines:position(params.position.line + 1, params.position.character + 1) - local text = matcher.hover(vm, position) + + local result, source = matcher.findResult(vm, position) + if not result then + return nil + end + + local text = matcher.hover(vm, result, source) if not text then return nil end |