diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-01-07 11:09:15 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-01-07 11:09:15 +0800 |
commit | 837b13984c4391afcc41f817b8afe31528173982 (patch) | |
tree | 5c554186311ae4ab0bfb327533c0f5d8bdb88bf3 /script/core/hover | |
parent | 8209df638b5e16f02dd9e9b2d689a40ef61b5127 (diff) | |
download | lua-language-server-837b13984c4391afcc41f817b8afe31528173982.zip |
fix #346 dont modify the cache
Diffstat (limited to 'script/core/hover')
-rw-r--r-- | script/core/hover/description.lua | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/script/core/hover/description.lua b/script/core/hover/description.lua index ddb84770..24360118 100644 --- a/script/core/hover/description.lua +++ b/script/core/hover/description.lua @@ -25,6 +25,7 @@ local function asStringInRequire(source, literal) result = ws.findUrisByFilePath(literal) end if result and #result > 0 then + local shows = {} for i, uri in ipairs(result) do local searcher = searchers and searchers[uri] uri = files.getOriginUri(uri) @@ -34,19 +35,19 @@ local function asStringInRequire(source, literal) end path = path:gsub('^[/\\]*', '') if vm.isMetaFile(uri) then - result[i] = ('* [[meta]](%s)'):format(uri) + shows[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)) + shows[i] = ('* [%s](%s) %s'):format(path, uri, lang.script('HOVER_USE_LUA_PATH', searcher)) else - result[i] = ('* [%s](%s)'):format(path, uri) + shows[i] = ('* [%s](%s)'):format(path, uri) end end - table.sort(result) + table.sort(shows) local md = markdown() - md:add('md', table.concat(result, '\n')) + md:add('md', table.concat(shows, '\n')) return md:string() end end |