1
0
mirror of https://github.com/golang/go synced 2024-10-01 08:18:32 -06:00
go/internal/lsp/cmd/test
Rob Findley de023d59a5 internal/lsp/protocol: unmarshal to pointers when dispatching requests
With #34111, we are forwarding the LSP from one gopls instance to
another. This exposed an asymmetry in our LSP dispatching: for both
ClientDispatcher and ServerDispatcher, we unmarshal to non-nil response
structs. This means that when forwarding the LSP, we translate empty
JSON responses (corresponding to nil values) into the non-nil zero
value.

This causes problems for some editors, as reported in #37570. Fix it by
instead unmarshaling to a pointer.

This is, of course, a somewhat dangerous change. I fixed the one NPE
that occurred in tests, and have done some mild manual testing.  I
wouldn't be surprised if we discover more NPEs later on, but I still
think this is the right change to make.

Updates golang/go#34111
Fixes golang/go#37570

Change-Id: Ie69e92d2821c829cdfc4f4ab303679a725f1f859
Reviewed-on: https://go-review.googlesource.com/c/tools/+/222058
Reviewed-by: Peter Weinberger <pjw@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-05 22:45:36 +00:00
..
check.go internal/lsp: refactor LSP server instantiation 2020-02-06 23:12:37 +00:00
cmdtest.go internal/lsp: add an upgrade all dependencies codelens 2020-03-02 21:30:18 +00:00
definition.go internal/lsp: fix a race in the command line tests 2019-11-22 16:15:56 +00:00
folding_range.go internal/lsp: fix a race in the command line tests 2019-11-22 16:15:56 +00:00
format.go internal/lsp: fix a race in the command line tests 2019-11-22 16:15:56 +00:00
highlight.go tools/gopls: add cmd support for highlight 2019-11-26 20:36:08 +00:00
implementation.go internal/lsp: store workspace package IDs with package paths 2020-01-09 22:04:34 +00:00
imports.go internal/lsp: fix golden generation for import tests 2019-12-05 21:54:53 +00:00
links.go internal/lsp: fix a race in the command line tests 2019-11-22 16:15:56 +00:00
prepare_rename.go internal/lsp/protocol: unmarshal to pointers when dispatching requests 2020-03-05 22:45:36 +00:00
references.go internal/lsp: add tests for references includeDeclaration setting 2020-01-23 01:39:50 +00:00
rename.go internal/lsp: fix a race in the command line tests 2019-11-22 16:15:56 +00:00
signature.go internal/lsp: remove unnecessary source.SignatureInformation type 2020-02-06 19:05:38 +00:00
suggested_fix.go internal/lsp: add quickfixes for missing dependencies in go.mod 2020-02-07 00:16:14 +00:00
symbols.go internal/lsp: fix a race in the command line tests 2019-11-22 16:15:56 +00:00