diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-21 14:32:14 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-21 14:32:14 +0800 |
commit | 789a3e93e7d403daf8e508606a1b946409658855 (patch) | |
tree | 5047b1433f3b2d7281ef2841658dd0836369d583 /server/src/matcher | |
parent | e50a8947ab1c6016e3763e76e0c3bedfa1b9c002 (diff) | |
download | lua-language-server-789a3e93e7d403daf8e508606a1b946409658855.zip |
require 文本的hover
Diffstat (limited to 'server/src/matcher')
-rw-r--r-- | server/src/matcher/hover.lua | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/server/src/matcher/hover.lua b/server/src/matcher/hover.lua index bfaead9a..9a556104 100644 --- a/server/src/matcher/hover.lua +++ b/server/src/matcher/hover.lua @@ -364,11 +364,26 @@ local function getValueHover(name, valueType, result, source, lib) ]]):format(text, tip) end -return function (result, source) +local function getStringHover(result, lsp) + if not result.uri then + return nil + end + if not lsp or not lsp.workspace then + return nil + end + local path = lsp.workspace:relativePathByUri(result.uri) + return ('[%s](%s)'):format(path:string(), result.uri) +end + +return function (result, source, lsp) if not result.value then return end + if result.type == 'string' then + return getStringHover(result, lsp) + end + local lib, fullKey, oo = findLib(result) local valueType = lib and lib.type or result.value.type or 'nil' local name = fullKey or buildValueName(result, source) |