summaryrefslogtreecommitdiff
path: root/script/provider/diagnostic.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-11-16 15:17:23 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-11-16 15:17:23 +0800
commit1d7931741eb7b91178f2ab94135f5cdc2c66c497 (patch)
tree8d22e26cdefee8d922bb5d5290485b20a21c6294 /script/provider/diagnostic.lua
parent1fbe3c121cb38eebfa2a3c17117c34ac30bfbd8c (diff)
downloadlua-language-server-1d7931741eb7b91178f2ab94135f5cdc2c66c497.zip
fix clearing diags with multi-workspace
Diffstat (limited to 'script/provider/diagnostic.lua')
-rw-r--r--script/provider/diagnostic.lua18
1 files changed, 14 insertions, 4 deletions
diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua
index 0f7d5dd0..fd78b9c2 100644
--- a/script/provider/diagnostic.lua
+++ b/script/provider/diagnostic.lua
@@ -183,14 +183,24 @@ function m.clearCacheExcept(uris)
end
end
-function m.clearAll(force)
+---@param uri? uri
+---@param force? boolean
+function m.clearAll(uri, force)
+ local scp
+ if uri then
+ scp = scope.getScope(uri)
+ end
if force then
for luri in files.eachFile() do
- m.clear(luri, force)
+ if not scp or scope.getScope(luri) == scp then
+ m.clear(luri, force)
+ end
end
else
for luri in pairs(m.cache) do
- m.clear(luri)
+ if not scp or scope.getScope(luri) == scp then
+ m.clear(luri)
+ end
end
end
end
@@ -564,7 +574,7 @@ function m.diagnosticsScope(uri, force)
return
end
if not force and not config.get(uri, 'Lua.diagnostics.enable') then
- m.clearAll()
+ m.clearAll(uri)
return
end
if not force and config.get(uri, 'Lua.diagnostics.workspaceDelay') < 0 then