diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-07-26 01:02:46 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-07-26 01:02:46 +0800 |
commit | 48d218c057134e7d94775bc890a0389a2009444f (patch) | |
tree | 38806908454158ac6cb4babe04c5ccb968f3c65e | |
parent | 66da8f7766713d89f251c21c18adb0978dc092cb (diff) | |
download | lua-language-server-48d218c057134e7d94775bc890a0389a2009444f.zip |
fix #1375
-rw-r--r-- | changelog.md | 1 | ||||
-rw-r--r-- | script/library.lua | 20 |
2 files changed, 14 insertions, 7 deletions
diff --git a/changelog.md b/changelog.md index a9e12f22..1654f2e9 100644 --- a/changelog.md +++ b/changelog.md @@ -10,6 +10,7 @@ * `FIX` [#1367](https://github.com/sumneko/lua-language-server/issues/1367) * `FIX` [#1368](https://github.com/sumneko/lua-language-server/issues/1368) * `FIX` [#1370](https://github.com/sumneko/lua-language-server/issues/1370) +* `FIX` [#1375](https://github.com/sumneko/lua-language-server/issues/1375) ## 3.5.0 `2022-7-19` diff --git a/script/library.lua b/script/library.lua index 9457b74b..b3b90933 100644 --- a/script/library.lua +++ b/script/library.lua @@ -324,7 +324,13 @@ local function load3rdConfigInDir(dir, configs, inner) end local function load3rdConfig(uri) - local configs = {} + local scp = scope.getScope(uri) + local configs = scp:get 'thirdConfigsCache' + if configs then + return configs + end + configs = {} + scp:set('thirdConfigsCache', configs) load3rdConfigInDir(innerThirdDir, configs, true) local thirdDirs = config.get(uri, 'Lua.workspace.userThirdParty') for _, thirdDir in ipairs(thirdDirs) do @@ -487,7 +493,6 @@ local function check3rdByFileName(uri, configs) end, id) end -local thirdConfigs ---@async local function check3rd(uri) if hasAsked then @@ -499,9 +504,7 @@ local function check3rd(uri) if not config.get(uri, 'Lua.workspace.checkThirdParty') then return end - if thirdConfigs == nil then - thirdConfigs = load3rdConfig(uri) or false - end + local thirdConfigs = load3rdConfig(uri) or false if not thirdConfigs then return end @@ -510,7 +513,9 @@ local function check3rd(uri) end local function check3rdOfWorkspace(suri) - local id = 'check3rdOfWorkspace:' .. suri + local scp = scope.getScope(suri) + scp:set('thirdConfigsCache', nil) + local id = 'check3rdOfWorkspace:' .. scp:getName() await.close(id) ---@async await.call(function () @@ -529,7 +534,8 @@ config.watch(function (uri, key, value, oldValue) initBuiltIn(uri) end if key == 'Lua.workspace.checkThirdParty' - or key == 'Lua.workspace.userThirdParty' then + or key == 'Lua.workspace.userThirdParty' + or key == '' then check3rdOfWorkspace(uri) end end) |