1
0
mirror of https://github.com/golang/go synced 2024-11-18 18:44:42 -07:00
go/internal/lsp/protocol
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
..
typescript internal/lsp/protocol: unmarshal to pointers when dispatching requests 2020-03-05 22:45:36 +00:00
context.go internal/telemetry: moving towards a unified event based exporter 2020-03-03 22:56:52 +00:00
doc.go internal/lsp: the core lsp protocol 2018-09-25 15:17:08 +00:00
enums.go internal/lsp: remove duplicated enums 2019-09-25 15:30:23 +00:00
log.go internal/lsp: fix lsp trace log format for gopls 2019-10-16 17:14:07 +00:00
protocol.go internal/lsp: refactor LSP server instantiation 2020-02-06 23:12:37 +00:00
span.go internal/span,lsp: disambiguate URIs, DocumentURIs, and paths 2020-02-14 22:51:03 +00:00
tsclient.go internal/lsp/protocol: unmarshal to pointers when dispatching requests 2020-03-05 22:45:36 +00:00
tsprotocol.go internal/lsp/protocol: unmarshal to pointers when dispatching requests 2020-03-05 22:45:36 +00:00
tsserver.go internal/lsp/protocol: unmarshal to pointers when dispatching requests 2020-03-05 22:45:36 +00:00