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 | |
parent | 8209df638b5e16f02dd9e9b2d689a40ef61b5127 (diff) | |
download | lua-language-server-837b13984c4391afcc41f817b8afe31528173982.zip |
fix #346 dont modify the cache
-rw-r--r-- | changelog.md | 3 | ||||
-rw-r--r-- | script/core/hover/description.lua | 11 |
2 files changed, 9 insertions, 5 deletions
diff --git a/changelog.md b/changelog.md index 519ef6be..d27fde87 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # changelog +## 1.11.2 +* `FIX` [#346](https://github.com/sumneko/lua-language-server/issues/346): dont modify the cache + ## 1.11.1 `2021-1-5` * `CHG` performance optimization 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 |