gopls/internal/lsp/protocol: fix json tags and indirect some zero values

Some of the json tags, especially for constructed structs, had improper
json tags (e.g., Range *Range `json:"Range"`, not `json:"range"). These
now start with lower-case letters.

Also, an optional field which is a struct type could be either
F FsType `json:"f,omitempty"`, or
F *FsType `json:"f,omitempty".

The second is generally better, as zero values should not be sent,
but there are many cases where the existing
code needs the first, to avoid allocations.

That is, if we're sending an empty optional field, there should be a *,
but if we're intializing a complicated structure (x.A.B.C.D = true, with
B and C optional) existing code wants no *. (These two cases could
conflict, and then the existing code would have to be changed.)

Fixes golang/go#55099

Change-Id: I947a69322bcddf4c963d34662b72b464b738d17c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/431218
Run-TryBot: Peter Weinberger <pjw@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
Peter Weinbergr 2022-09-16 13:22:56 -04:00 committed by Peter Weinberger
parent a61f20e1aa
commit 45ad958c90
4 changed files with 183 additions and 183 deletions

View File

@ -5,7 +5,7 @@
package protocol
// Code generated from version 3.17.0 of protocol/metaModel.json.
// git hash 8de18faed635819dd2bc631d2c26ce4a18f7cf4a (as of Tue Sep 13 10:45:25 2022)
// git hash 8de18faed635819dd2bc631d2c26ce4a18f7cf4a (as of Fri Sep 16 13:04:31 2022)
// Code generated; DO NOT EDIT.
import (

View File

@ -5,7 +5,7 @@
package protocol
// Code generated from version 3.17.0 of protocol/metaModel.json.
// git hash 8de18faed635819dd2bc631d2c26ce4a18f7cf4a (as of Tue Sep 13 10:45:25 2022)
// git hash 8de18faed635819dd2bc631d2c26ce4a18f7cf4a (as of Fri Sep 16 13:04:31 2022)
// Code generated; DO NOT EDIT.
import "encoding/json"

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@
package protocol
// Code generated from version 3.17.0 of protocol/metaModel.json.
// git hash 8de18faed635819dd2bc631d2c26ce4a18f7cf4a (as of Tue Sep 13 10:45:25 2022)
// git hash 8de18faed635819dd2bc631d2c26ce4a18f7cf4a (as of Fri Sep 16 13:04:31 2022)
// Code generated; DO NOT EDIT.
import (