From 3e7148b2facff7edbfacc39961fa6a633e1eea64 Mon Sep 17 00:00:00 2001 From: Rebecca Stambler Date: Tue, 16 Apr 2019 12:58:00 -0400 Subject: [PATCH] internal/lsp: log errors when diagnostics fail This will allow us to better track the errors that might cause golang/go#30786. Change-Id: I310ad0fd0eda3102d5763e28fc383a4994ef0ff3 Reviewed-on: https://go-review.googlesource.com/c/tools/+/172280 Run-TryBot: Rebecca Stambler Reviewed-by: Ian Cottrell --- internal/lsp/diagnostics.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/lsp/diagnostics.go b/internal/lsp/diagnostics.go index a479e679..aa9fa0fc 100644 --- a/internal/lsp/diagnostics.go +++ b/internal/lsp/diagnostics.go @@ -22,11 +22,13 @@ func (s *Server) cacheAndDiagnose(ctx context.Context, uri span.URI, content str go func() { ctx := view.BackgroundContext() if ctx.Err() != nil { + s.log.Errorf(ctx, "canceling diagnostics for %s: %v", uri, ctx.Err()) return } reports, err := source.Diagnostics(ctx, view, uri) if err != nil { - return // handle error? + s.log.Errorf(ctx, "failed to compute diagnostics for %s: %v", uri, err) + return } s.undeliveredMu.Lock()