Skip to content

Commit

Permalink
gopls/internal/golang: add missing json tags for hoverResult
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
findleyr authored and gopherbot committed Feb 21, 2025
1 parent 6e3d8bc commit 3d7c2e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions gopls/internal/golang/hover.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,32 +57,32 @@ type hoverResult struct {
// TODO(adonovan): in what syntax? It (usually) comes from doc.Synopsis,
// which produces "Text" form, but it may be fed to
// DocCommentToMarkdown, which expects doc comment syntax.
Synopsis string
Synopsis string `json:"synopsis"`

// FullDocumentation is the symbol's full documentation.
FullDocumentation string
FullDocumentation string `json:"fullDocumentation"`

// Signature is the symbol's Signature.
Signature string
Signature string `json:"signature"`

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

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

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

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

// New fields go below, and are unexported. The existing
// exported fields are underspecified and have already
Expand Down
4 changes: 2 additions & 2 deletions gopls/internal/test/marker/testdata/hover/json.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ func MyFunc(i int) string { //@ hover("MyFunc", "MyFunc", MyFunc)
return ""
}
-- @MyFunc --
{"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"}
{"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"}
-- @MyType --
{"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"}
{"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 comments on commit 3d7c2e2

Please sign in to comment.