go/internal/lsp/diff/myers
Rebecca Stambler 008e477491 internal/lsp, gopls: recover from go-diff panics
This CL handles the panic in the sergi/go-diff library which has not
yet been resolved. We add an error return to the ComputeEdits function
and return an error if there is a panic. I'm not sure if this is the
best approach, but it does seem better than allowing the server to
crash.

A concern would be that the user wouldn't know why their code wasn't
being formatted, but hopefully they might look through the logs and
notice the error message. At least, other features would continue
working. The best fix will definitely be the fix for the panic, but that
is not yet available.

Threading through the error return was not pretty, but I thought it was
probably worth doing since it could be needed in other situations.

Updates golang/go#42927

Change-Id: I7f0c05eb296ef9e93b4de8ef071301cdb9dce152
Reviewed-on: https://go-review.googlesource.com/c/tools/+/278775
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Rebecca Stambler <rstambler@golang.org>
2020-12-17 16:56:54 +00:00
..
diff.go internal/lsp, gopls: recover from go-diff panics 2020-12-17 16:56:54 +00:00
diff_test.go internal/lsp: move unified diff testing to the diff interface 2019-10-04 03:44:59 +00:00