diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-18 15:53:10 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-18 15:53:10 +0800 |
commit | 8b060037c9fd5961f8de6b9da674d5a29a77334e (patch) | |
tree | 8f069f06af2ad9056d28cb710e50e0a480144abf /script-beta/core/hover | |
parent | 49f993b2cec1f51a9d9a5008c378542688ff6a3f (diff) | |
download | lua-language-server-8b060037c9fd5961f8de6b9da674d5a29a77334e.zip |
修改无工作目录时的细节
Diffstat (limited to 'script-beta/core/hover')
-rw-r--r-- | script-beta/core/hover/description.lua | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/script-beta/core/hover/description.lua b/script-beta/core/hover/description.lua index a3c9429f..dd04373e 100644 --- a/script-beta/core/hover/description.lua +++ b/script-beta/core/hover/description.lua @@ -11,6 +11,7 @@ local platform = require 'bee.platform' local library = require 'library' local function asStringInRequire(source, literal) + local rootPath = ws.path or '' local parent = source.parent if parent and parent.type == 'callargs' then local result, searchers @@ -31,14 +32,14 @@ local function asStringInRequire(source, literal) local searcher = searchers and furi.decode(searchers[uri]) uri = files.getOriginUri(uri) local path = furi.decode(uri) - if files.eq(path:sub(1, #ws.path), ws.path) then - path = path:sub(#ws.path + 1) + if files.eq(path:sub(1, #rootPath), rootPath) then + path = path:sub(#rootPath + 1) end path = path:gsub('^[/\\]*', '') if vm.isMetaFile(uri) then result[i] = ('* [[meta]](%s)'):format(uri) elseif searcher then - searcher = searcher:sub(#ws.path + 1) + searcher = searcher:sub(#rootPath + 1) searcher = ws.normalize(searcher) result[i] = ('* [%s](%s) %s'):format(path, uri, lang.script('HOVER_USE_LUA_PATH', searcher)) else |