Skip to content

Commit 3d7c2e2

Browse files
findleyrgopherbot
authored andcommitted
gopls/internal/golang: add missing json tags for hoverResult
In my haste to partially revert CL 635226 in 651238, I failed to add json struct tags. Add them back. For golang/go#71879 Change-Id: I45190cba5154eeed7b6a49db51d2a2a51999be7a Reviewed-on: https://go-review.googlesource.com/c/tools/+/651618 Auto-Submit: Robert Findley <[email protected]> Reviewed-by: Alan Donovan <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 6e3d8bc commit 3d7c2e2

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

gopls/internal/golang/hover.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,32 +57,32 @@ type hoverResult struct {
5757
// TODO(adonovan): in what syntax? It (usually) comes from doc.Synopsis,
5858
// which produces "Text" form, but it may be fed to
5959
// DocCommentToMarkdown, which expects doc comment syntax.
60-
Synopsis string
60+
Synopsis string `json:"synopsis"`
6161

6262
// FullDocumentation is the symbol's full documentation.
63-
FullDocumentation string
63+
FullDocumentation string `json:"fullDocumentation"`
6464

6565
// Signature is the symbol's Signature.
66-
Signature string
66+
Signature string `json:"signature"`
6767

6868
// SingleLine is a single line describing the symbol.
6969
// This is recommended only for use in clients that show a single line for hover.
70-
SingleLine string
70+
SingleLine string `json:"singleLine"`
7171

7272
// SymbolName is the human-readable name to use for the symbol in links.
73-
SymbolName string
73+
SymbolName string `json:"symbolName"`
7474

7575
// LinkPath is the path of the package enclosing the given symbol,
7676
// with the module portion (if any) replaced by "module@version".
7777
//
7878
// For example: "github.com/google/go-github/[email protected]/github".
7979
//
8080
// Use LinkTarget + "/" + LinkPath + "#" + LinkAnchor to form a pkgsite URL.
81-
LinkPath string
81+
LinkPath string `json:"linkPath"`
8282

8383
// LinkAnchor is the pkg.go.dev link anchor for the given symbol.
8484
// For example, the "Node" part of "pkg.go.dev/go/ast#Node".
85-
LinkAnchor string
85+
LinkAnchor string `json:"linkAnchor"`
8686

8787
// New fields go below, and are unexported. The existing
8888
// exported fields are underspecified and have already

gopls/internal/test/marker/testdata/hover/json.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ func MyFunc(i int) string { //@ hover("MyFunc", "MyFunc", MyFunc)
2828
return ""
2929
}
3030
-- @MyFunc --
31-
{"Synopsis":"MyFunc is a function.","FullDocumentation":"MyFunc is a function.\n","Signature":"func MyFunc(i int) string","SingleLine":"func MyFunc(i int) string","SymbolName":"p.MyFunc","LinkPath":"example.com/p","LinkAnchor":"MyFunc"}
31+
{"synopsis":"MyFunc is a function.","fullDocumentation":"MyFunc is a function.\n","signature":"func MyFunc(i int) string","singleLine":"func MyFunc(i int) string","symbolName":"p.MyFunc","linkPath":"example.com/p","linkAnchor":"MyFunc"}
3232
-- @MyType --
33-
{"Synopsis":"MyType is a type.","FullDocumentation":"MyType is a type.\n","Signature":"type MyType struct { // size=24 (0x18)\n\tF int // a field\n\tS string // a string field\n}\n","SingleLine":"type MyType struct{F int; S string}","SymbolName":"p.MyType","LinkPath":"example.com/p","LinkAnchor":"MyType"}
33+
{"synopsis":"MyType is a type.","fullDocumentation":"MyType is a type.\n","signature":"type MyType struct { // size=24 (0x18)\n\tF int // a field\n\tS string // a string field\n}\n","singleLine":"type MyType struct{F int; S string}","symbolName":"p.MyType","linkPath":"example.com/p","linkAnchor":"MyType"}

0 commit comments

Comments
 (0)