Skip to content

Commit 528c807

Browse files
committed
fix #1027
1 parent a3f5b1c commit 528c807

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
+ `no-implicit-any`: renamed to `no-unknown`
88
* `CHG` formatter: no longer need` --preview`
99
* `FIX` semantic: color of `function`
10+
* `FIX` [#1027](https://github.com/sumneko/lua-language-server/issues/1027)
1011
* `FIX` [#1028](https://github.com/sumneko/lua-language-server/issues/1028)
1112

1213
## 2.6.8

script/files.lua

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ end
3535

3636
m.reset()
3737

38-
local fixedUri = {}
39-
--- 获取文件的真实uri
38+
local uriMap = {}
39+
-- 获取文件的真实uri,但不穿透软链接
4040
---@param uri uri
4141
---@return uri
4242
function m.getRealUri(uri)
@@ -47,16 +47,19 @@ function m.getRealUri(uri)
4747
return uri
4848
end
4949
suc, res = pcall(fs.canonical, path)
50-
if not suc or res:string():gsub('/', '\\') == filename then
50+
if not suc then
5151
return uri
5252
end
5353
filename = res:string()
5454
local ruri = furi.encode(filename)
55-
if uri ~= ruri and not fixedUri[ruri] then
56-
fixedUri[ruri] = true
55+
if uri == ruri then
56+
return ruri
57+
end
58+
if not uriMap[ruri] then
59+
uriMap[ruri] = uri
5760
log.warn(('Fix real file uri: %s -> %s'):format(uri, ruri))
5861
end
59-
return ruri
62+
return uriMap[ruri]
6063
end
6164

6265
--- 打开文件

0 commit comments

Comments
 (0)