summaryrefslogtreecommitdiff
path: root/server-beta/src/provider/diagnostic.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server-beta/src/provider/diagnostic.lua')
-rw-r--r--server-beta/src/provider/diagnostic.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/server-beta/src/provider/diagnostic.lua b/server-beta/src/provider/diagnostic.lua
index 6583c8d8..df5fd419 100644
--- a/server-beta/src/provider/diagnostic.lua
+++ b/server-beta/src/provider/diagnostic.lua
@@ -144,10 +144,20 @@ function m.doDiagnostic(uri, syntaxOnly)
local syntax = m.syntaxErrors(uri, ast)
local diagnostics = m.diagnostics(uri, syntaxOnly)
+ local newDiag = merge(syntax, diagnostics)
+ local lastDiag = files.getDiagnostic(uri)
+ if #newDiag == 0 then
+ if not lastDiag then
+ return
+ end
+ files.setDiagnostic(uri, nil)
+ else
+ files.setDiagnostic(uri, newDiag)
+ end
proto.notify('textDocument/publishDiagnostics', {
uri = uri,
- diagnostics = merge(syntax, diagnostics),
+ diagnostics = newDiag,
})
end