diff options
Diffstat (limited to 'script-beta')
-rw-r--r-- | script-beta/core/hover/description.lua | 7 | ||||
-rw-r--r-- | script-beta/workspace/workspace.lua | 3 |
2 files changed, 7 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 diff --git a/script-beta/workspace/workspace.lua b/script-beta/workspace/workspace.lua index ec7af5da..a4acac79 100644 --- a/script-beta/workspace/workspace.lua +++ b/script-beta/workspace/workspace.lua @@ -298,6 +298,9 @@ end function m.getRelativePath(uri) local path = furi.decode(uri) + if not m.path then + return m.normalize(path) + end local _, pos = m.normalize(path):lower():find(m.path:lower(), 1, true) if pos then return m.normalize(path:sub(pos + 1)) |