Skip to content

Commit 48d218c

Browse files
committed
fix #1375
1 parent 66da8f7 commit 48d218c

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* `FIX` [#1367](https://github.com/sumneko/lua-language-server/issues/1367)
1111
* `FIX` [#1368](https://github.com/sumneko/lua-language-server/issues/1368)
1212
* `FIX` [#1370](https://github.com/sumneko/lua-language-server/issues/1370)
13+
* `FIX` [#1375](https://github.com/sumneko/lua-language-server/issues/1375)
1314

1415
## 3.5.0
1516
`2022-7-19`

script/library.lua

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,13 @@ local function load3rdConfigInDir(dir, configs, inner)
324324
end
325325

326326
local function load3rdConfig(uri)
327-
local configs = {}
327+
local scp = scope.getScope(uri)
328+
local configs = scp:get 'thirdConfigsCache'
329+
if configs then
330+
return configs
331+
end
332+
configs = {}
333+
scp:set('thirdConfigsCache', configs)
328334
load3rdConfigInDir(innerThirdDir, configs, true)
329335
local thirdDirs = config.get(uri, 'Lua.workspace.userThirdParty')
330336
for _, thirdDir in ipairs(thirdDirs) do
@@ -487,7 +493,6 @@ local function check3rdByFileName(uri, configs)
487493
end, id)
488494
end
489495

490-
local thirdConfigs
491496
---@async
492497
local function check3rd(uri)
493498
if hasAsked then
@@ -499,9 +504,7 @@ local function check3rd(uri)
499504
if not config.get(uri, 'Lua.workspace.checkThirdParty') then
500505
return
501506
end
502-
if thirdConfigs == nil then
503-
thirdConfigs = load3rdConfig(uri) or false
504-
end
507+
local thirdConfigs = load3rdConfig(uri) or false
505508
if not thirdConfigs then
506509
return
507510
end
@@ -510,7 +513,9 @@ local function check3rd(uri)
510513
end
511514

512515
local function check3rdOfWorkspace(suri)
513-
local id = 'check3rdOfWorkspace:' .. suri
516+
local scp = scope.getScope(suri)
517+
scp:set('thirdConfigsCache', nil)
518+
local id = 'check3rdOfWorkspace:' .. scp:getName()
514519
await.close(id)
515520
---@async
516521
await.call(function ()
@@ -529,7 +534,8 @@ config.watch(function (uri, key, value, oldValue)
529534
initBuiltIn(uri)
530535
end
531536
if key == 'Lua.workspace.checkThirdParty'
532-
or key == 'Lua.workspace.userThirdParty' then
537+
or key == 'Lua.workspace.userThirdParty'
538+
or key == '' then
533539
check3rdOfWorkspace(uri)
534540
end
535541
end)

0 commit comments

Comments
 (0)