Skip to content

Commit c8db761

Browse files
committed
internal/lsp/cache: keep going on failed analyzers
A single failed analyzer should not prevent others from reporting their diagnostics. This is especially relevant as we work on updating analyzers to support generic code. Change-Id: If1d958347649a99df92701fc4a4574cb7020596b Reviewed-on: https://go-review.googlesource.com/c/tools/+/351550 Trust: Robert Findley <[email protected]> Run-TryBot: Robert Findley <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Rebecca Stambler <[email protected]>
1 parent 2847958 commit c8db761

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/lsp/cache/analysis.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ func (s *snapshot) Analyze(ctx context.Context, id string, analyzers []*source.A
4646
for _, ah := range roots {
4747
diagnostics, _, err := ah.analyze(ctx, s)
4848
if err != nil {
49-
return nil, err
49+
// Keep going if a single analyzer failed.
50+
event.Error(ctx, fmt.Sprintf("analyzer %q failed", ah.analyzer.Name), err)
51+
continue
5052
}
5153
results = append(results, diagnostics...)
5254
}

0 commit comments

Comments
 (0)