File tree Expand file tree Collapse file tree 5 files changed +30
-10
lines changed
Expand file tree Collapse file tree 5 files changed +30
-10
lines changed Original file line number Diff line number Diff line change 99* ` FIX ` modify luarc failed
1010* ` FIX ` library files not recognized correctly
1111* ` FIX ` [ #906 ] ( https://github.com/sumneko/lua-language-server/issues/906 )
12+ * ` FIX ` [ #920 ] ( https://github.com/sumneko/lua-language-server/issues/920 )
1213
1314## 2.6.0
1415` 2022-1-13 `
Original file line number Diff line number Diff line change @@ -124,11 +124,11 @@ function m.isLibrary(uri)
124124end
125125
126126--- 获取库文件的根目录
127- function m .getLibraryPath (uri )
127+ function m .getLibraryUri (uri )
128128 for _ , scp in ipairs (scope .folders ) do
129129 local map = scp :get ' libraryMap'
130130 if map and map [uri ] ~= nil then
131- return scp . uri
131+ return map [ uri ]
132132 end
133133 end
134134 return nil
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ function m.getVisiblePath(suri, path)
4343 local strict = config .get (suri , ' Lua.runtime.pathStrict' )
4444 path = workspace .normalize (path )
4545 local uri = furi .encode (path )
46- local libraryPath = files .getLibraryPath (uri )
46+ local libraryPath = furi . decode ( files .getLibraryUri (uri ) )
4747 local scp = scope .getScope (suri )
4848 local cache = scp :get (' visiblePath' ) or scp :set (' visiblePath' , {})
4949 if not cache [path ] then
@@ -145,10 +145,18 @@ local function removeVisiblePath(uri)
145145 path = workspace .normalize (path )
146146 for _ , scp in ipairs (workspace .folders ) do
147147 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 )
149159 end
150- scope .getScope (nil ):get (' visiblePath' )[path ] = nil
151- scope .getScope (nil ):get (' requireName' ):dropUri (uri )
152160end
153161
154162function m .flush (suri )
Original file line number Diff line number Diff line change @@ -3060,3 +3060,10 @@ local t
30603060t:testFunc2(<??>)
30613061]]
30623062(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)
110110 end
111111 assert (result )
112112 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 )
116115 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
118122 end
119123 files .remove (' ' )
120124 end
You can’t perform that action at this time.
0 commit comments