summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-10 02:27:49 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-10 02:27:49 +0800
commit528c8073b4785a2a0cfd80466357d2ba252ed950 (patch)
treeacf67e5980e6b63a1e96e759adab361470284a2b
parenta3f5b1ceb2b6722a28671cb6e2633b3fc0ae6713 (diff)
downloadlua-language-server-528c8073b4785a2a0cfd80466357d2ba252ed950.zip
fix #1027
-rw-r--r--changelog.md1
-rw-r--r--script/files.lua15
2 files changed, 10 insertions, 6 deletions
diff --git a/changelog.md b/changelog.md
index 4a9413f7..61a81c69 100644
--- a/changelog.md
+++ b/changelog.md
@@ -7,6 +7,7 @@
+ `no-implicit-any`: renamed to `no-unknown`
* `CHG` formatter: no longer need` --preview`
* `FIX` semantic: color of `function`
+* `FIX` [#1027](https://github.com/sumneko/lua-language-server/issues/1027)
* `FIX` [#1028](https://github.com/sumneko/lua-language-server/issues/1028)
## 2.6.8
diff --git a/script/files.lua b/script/files.lua
index 682f630f..2ddb00d6 100644
--- a/script/files.lua
+++ b/script/files.lua
@@ -35,8 +35,8 @@ end
m.reset()
-local fixedUri = {}
---- 获取文件的真实uri
+local uriMap = {}
+-- 获取文件的真实uri,但不穿透软链接
---@param uri uri
---@return uri
function m.getRealUri(uri)
@@ -47,16 +47,19 @@ function m.getRealUri(uri)
return uri
end
suc, res = pcall(fs.canonical, path)
- if not suc or res:string():gsub('/', '\\') == filename then
+ if not suc then
return uri
end
filename = res:string()
local ruri = furi.encode(filename)
- if uri ~= ruri and not fixedUri[ruri] then
- fixedUri[ruri] = true
+ if uri == ruri then
+ return ruri
+ end
+ if not uriMap[ruri] then
+ uriMap[ruri] = uri
log.warn(('Fix real file uri: %s -> %s'):format(uri, ruri))
end
- return ruri
+ return uriMap[ruri]
end
--- 打开文件