summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
--- 打开文件