summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/provider/diagnostic.lua18
-rw-r--r--script/provider/provider.lua2
2 files changed, 15 insertions, 5 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
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index ecfaeb62..ce762d1d 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -1167,7 +1167,7 @@ m.register '$/status/click' {
end
elseif result == 'Restart Server' then
local diag = require 'provider.diagnostic'
- diag.clearAll(true)
+ diag.clearAll(nil, true)
os.exit(0, true)
elseif result == 'Clear Node Cache' then
local vm = require 'vm'