File tree 5 files changed +30
-10
lines changed
5 files changed +30
-10
lines changed Original file line number Diff line number Diff line change 9
9
* ` FIX ` modify luarc failed
10
10
* ` FIX ` library files not recognized correctly
11
11
* ` FIX ` [ #906 ] ( https://github.com./sumneko/lua-language-server/issues/906 )
12
+ * ` FIX ` [ #920 ] ( https://github.com./sumneko/lua-language-server/issues/920 )
12
13
13
14
## 2.6.0
14
15
` 2022-1-13 `
Original file line number Diff line number Diff line change @@ -124,11 +124,11 @@ function m.isLibrary(uri)
124
124
end
125
125
126
126
--- 获取库文件的根目录
127
- function m .getLibraryPath (uri )
127
+ function m .getLibraryUri (uri )
128
128
for _ , scp in ipairs (scope .folders ) do
129
129
local map = scp :get ' libraryMap'
130
130
if map and map [uri ] ~= nil then
131
- return scp . uri
131
+ return map [ uri ]
132
132
end
133
133
end
134
134
return nil
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ function m.getVisiblePath(suri, path)
43
43
local strict = config .get (suri , ' Lua.runtime.pathStrict' )
44
44
path = workspace .normalize (path )
45
45
local uri = furi .encode (path )
46
- local libraryPath = files .getLibraryPath (uri )
46
+ local libraryPath = furi . decode ( files .getLibraryUri (uri ) )
47
47
local scp = scope .getScope (suri )
48
48
local cache = scp :get (' visiblePath' ) or scp :set (' visiblePath' , {})
49
49
if not cache [path ] then
@@ -145,10 +145,18 @@ local function removeVisiblePath(uri)
145
145
path = workspace .normalize (path )
146
146
for _ , scp in ipairs (workspace .folders ) do
147
147
scp :get (' visiblePath' )[path ] = nil
148
- scp :get (' requireName' ):dropUri (uri )
148
+ --- @type collector
149
+ local clt = scp :get (' requireName' )
150
+ if clt then
151
+ clt :dropUri (uri )
152
+ end
153
+ end
154
+ scope .fallback :get (' visiblePath' )[path ] = nil
155
+ --- @type collector
156
+ local clt = scope .fallback :get (' requireName' )
157
+ if clt then
158
+ clt :dropUri (uri )
149
159
end
150
- scope .getScope (nil ):get (' visiblePath' )[path ] = nil
151
- scope .getScope (nil ):get (' requireName' ):dropUri (uri )
152
160
end
153
161
154
162
function m .flush (suri )
Original file line number Diff line number Diff line change @@ -3060,3 +3060,10 @@ local t
3060
3060
t:testFunc2(<??>)
3061
3061
]]
3062
3062
(EXISTS )
3063
+
3064
+ TEST [[
3065
+ require '<??>'
3066
+ ]]
3067
+ (function (results )
3068
+ assert (# results == 11 )
3069
+ end )
Original file line number Diff line number Diff line change @@ -110,11 +110,15 @@ function TEST(script)
110
110
end
111
111
assert (result )
112
112
result .complete = nil
113
- if expect .include then
114
- expect .include = nil
115
- assert (include (expect , result ))
113
+ if type (expect ) == ' function' then
114
+ expect (result )
116
115
else
117
- assert (eq (expect , result ))
116
+ if expect .include then
117
+ expect .include = nil
118
+ assert (include (expect , result ))
119
+ else
120
+ assert (eq (expect , result ))
121
+ end
118
122
end
119
123
files .remove (' ' )
120
124
end
You can’t perform that action at this time.
0 commit comments