From 8209df638b5e16f02dd9e9b2d689a40ef61b5127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 7 Jan 2021 11:07:23 +0800 Subject: Revert "fix" This reverts commit 7530d7551220961f8e8b8346a8eb33fc03863694. --- script/core/hover/description.lua | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/script/core/hover/description.lua b/script/core/hover/description.lua index a00c16dd..ddb84770 100644 --- a/script/core/hover/description.lua +++ b/script/core/hover/description.lua @@ -28,22 +28,20 @@ local function asStringInRequire(source, literal) for i, uri in ipairs(result) do local searcher = searchers and searchers[uri] uri = files.getOriginUri(uri) - if uri then - local path = furi.decode(uri) - 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(#rootPath + 1) - searcher = ws.normalize(searcher) - searcher = searcher:gsub('^[/\\]+', '') - result[i] = ('* [%s](%s) %s'):format(path, uri, lang.script('HOVER_USE_LUA_PATH', searcher)) - else - result[i] = ('* [%s](%s)'):format(path, uri) - end + local path = furi.decode(uri) + 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(#rootPath + 1) + searcher = ws.normalize(searcher) + searcher = searcher:gsub('^[/\\]+', '') + result[i] = ('* [%s](%s) %s'):format(path, uri, lang.script('HOVER_USE_LUA_PATH', searcher)) + else + result[i] = ('* [%s](%s)'):format(path, uri) end end table.sort(result) -- cgit v1.2.3