summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/provider/diagnostic.lua10
1 files changed, 4 insertions, 6 deletions
diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua
index b359c21c..458b3764 100644
--- a/script/provider/diagnostic.lua
+++ b/script/provider/diagnostic.lua
@@ -131,9 +131,10 @@ local function mergeDiags(a, b, c)
return t
end
+-- enable `push`, disable `clear`
function m.clear(uri)
await.close('diag:' .. uri)
- if not m.cache[uri] then
+ if m.cache[uri] == nil then
return
end
m.cache[uri] = nil
@@ -144,6 +145,7 @@ function m.clear(uri)
log.info('clearDiagnostics', uri)
end
+-- enable `push` and `send`
function m.clearCache(uri)
m.cache[uri] = false
end
@@ -256,11 +258,6 @@ function m.doDiagnostic(uri, isScopeDiag)
end
end
- -- always re-sent diagnostics of current file
- if not isScopeDiag then
- m.cache[uri] = nil
- end
-
pushResult()
local lastPushClock = time.time()
@@ -435,6 +432,7 @@ files.watch(function (ev, uri) ---@async
m.refresh(uri)
elseif ev == 'open' then
if ws.isReady(uri) then
+ m.clearCache(uri)
xpcall(m.doDiagnostic, log.error, uri)
end
elseif ev == 'close' then