summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rw-r--r--script/provider/diagnostic.lua16
-rw-r--r--script/provider/provider.lua2
2 files changed, 13 insertions, 5 deletions
diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua
index 5957e3eb..23dad33d 100644
--- a/script/provider/diagnostic.lua
+++ b/script/provider/diagnostic.lua
@@ -139,9 +139,9 @@ local function mergeDiags(a, b, c)
end
-- enable `push`, disable `clear`
-function m.clear(uri)
+function m.clear(uri, force)
await.close('diag:' .. uri)
- if m.cache[uri] == nil then
+ if m.cache[uri] == nil and not force then
return
end
m.cache[uri] = nil
@@ -169,9 +169,15 @@ function m.clearCacheExcept(uris)
end
end
-function m.clearAll()
- for luri in pairs(m.cache) do
- m.clear(luri)
+function m.clearAll(force)
+ if force then
+ for luri in files.eachFile() do
+ m.clear(luri, force)
+ end
+ else
+ for luri in pairs(m.cache) do
+ m.clear(luri)
+ end
end
end
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index e2531abf..205be08c 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -1019,6 +1019,8 @@ m.register '$/status/click' {
diagnostic.diagnosticsScope(scp.uri, true)
end
elseif result == 'Restart Server' then
+ local diag = require 'provider.diagnostic'
+ diag.clearAll(true)
os.exit(0, true)
end
end