diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-03-11 14:52:09 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-03-11 14:52:09 +0800 |
commit | 764084f9d2e8f7bb69aea8fc97453f10c9ba7f77 (patch) | |
tree | b1db5b23a9e7569eec21f7df250fd61d0cd7a343 /server/src/core/hover/hover.lua | |
parent | f34e6c5ff4ed205881db18049c4a3db542c90b6b (diff) | |
download | lua-language-server-764084f9d2e8f7bb69aea8fc97453f10c9ba7f77.zip |
更新crossfile
Diffstat (limited to 'server/src/core/hover/hover.lua')
-rw-r--r-- | server/src/core/hover/hover.lua | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/server/src/core/hover/hover.lua b/server/src/core/hover/hover.lua index 2e87936c..c7aba17e 100644 --- a/server/src/core/hover/hover.lua +++ b/server/src/core/hover/hover.lua @@ -175,19 +175,6 @@ local function getValueHover(source, name, value, lib) } end -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 { - description = ('[%s](%s)'):format(path:string(), result.uri), - } -end - local function hoverAsValue(source, lsp, select) local lib, fullkey = findLib(source) local value = source:bindValue() @@ -212,14 +199,26 @@ local function hoverAsValue(source, lsp, select) return hover end +local function hoverAsTargetUri(source, lsp) + local uri = source:get 'target uri' + if not lsp or not lsp.workspace then + return nil + end + local path = lsp.workspace:relativePathByUri(uri) + return { + description = ('[%s](%s)'):format(path:string(), uri), + } +end + return function (source, lsp, select) if not source then return nil end - if source.type ~= 'name' then - return + if source:get 'target uri' then + return hoverAsTargetUri(source, lsp) end - if source:bindValue() then + if source.type == 'name' and source:bindValue() then return hoverAsValue(source, lsp, select) end + return nil end |