From eaa3c93756ab549f0184ebdb2d50c350d904bd70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 19 Nov 2019 18:30:25 +0800 Subject: =?UTF-8?q?=E8=AF=8A=E6=96=AD=E8=BF=9B=E8=A1=8C=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=EF=BC=8C=E4=BB=A5=E5=85=8D=E5=BD=B1=E5=93=8D?= =?UTF-8?q?=E5=89=8D=E7=AB=AF=E7=9A=84=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server-beta/src/provider/diagnostic.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'server-beta/src/provider/diagnostic.lua') 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 -- cgit v1.2.3