mirror of
https://github.com/golang/go
synced 2024-11-19 05:24:42 -07:00
cfcbc7796e
This change refactors some of the logic that builds a link anchor for a given symbol, pushing the actual Link into the HoverInformation struct. This is necessary because type information is needed to build up that link in certain cases, like methods. The last step will be to correctly display struct fields. Updates golang/go#34240 Fixes golang/go#36031 Change-Id: I7f989faddbaa07f91838a870b4477bf78ce8ddf7 Reviewed-on: https://go-review.googlesource.com/c/tools/+/210201 Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
159 lines
3.6 KiB
Plaintext
159 lines
3.6 KiB
Plaintext
-- Member-definition --
|
|
godef/a/d.go:6:2-8: defined here as \@Member
|
|
|
|
[`(a.Thing).Member` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a#Thing.Member)
|
|
|
|
```go
|
|
field Member string
|
|
```
|
|
-- Member-definition-json --
|
|
{
|
|
"span": {
|
|
"uri": "file://godef/a/d.go",
|
|
"start": {
|
|
"line": 6,
|
|
"column": 2,
|
|
"offset": 55
|
|
},
|
|
"end": {
|
|
"line": 6,
|
|
"column": 8,
|
|
"offset": 61
|
|
}
|
|
},
|
|
"description": "\\@Member\n\n[`(a.Thing).Member` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a#Thing.Member)\n\n```go\nfield Member string\n```"
|
|
}
|
|
|
|
-- Member-hover --
|
|
\@Member
|
|
|
|
[`(a.Thing).Member` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a#Thing.Member)
|
|
|
|
```go
|
|
field Member string
|
|
```
|
|
-- Method-definition --
|
|
godef/a/d.go:15:16-22: defined here as [`(a.Thing).Method` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a#Thing.Method)
|
|
|
|
```go
|
|
func (Thing).Method(i int) string
|
|
```
|
|
-- Method-definition-json --
|
|
{
|
|
"span": {
|
|
"uri": "file://godef/a/d.go",
|
|
"start": {
|
|
"line": 15,
|
|
"column": 16,
|
|
"offset": 184
|
|
},
|
|
"end": {
|
|
"line": 15,
|
|
"column": 22,
|
|
"offset": 190
|
|
}
|
|
},
|
|
"description": "[`(a.Thing).Method` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a#Thing.Method)\n\n```go\nfunc (Thing).Method(i int) string\n```"
|
|
}
|
|
|
|
-- Method-hover --
|
|
[`(a.Thing).Method` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a#Thing.Method)
|
|
|
|
```go
|
|
func (Thing).Method(i int) string
|
|
```
|
|
-- Other-definition --
|
|
godef/a/d.go:9:5-10: defined here as [`a.Other` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a#Other)
|
|
|
|
```go
|
|
var Other Thing
|
|
```
|
|
-- Other-definition-json --
|
|
{
|
|
"span": {
|
|
"uri": "file://godef/a/d.go",
|
|
"start": {
|
|
"line": 9,
|
|
"column": 5,
|
|
"offset": 86
|
|
},
|
|
"end": {
|
|
"line": 9,
|
|
"column": 10,
|
|
"offset": 91
|
|
}
|
|
},
|
|
"description": "[`a.Other` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a#Other)\n\n```go\nvar Other Thing\n```"
|
|
}
|
|
|
|
-- Other-hover --
|
|
[`a.Other` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a#Other)
|
|
|
|
```go
|
|
var Other Thing
|
|
```
|
|
-- Thing-definition --
|
|
godef/a/d.go:5:6-11: defined here as [`a.Thing` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a#Thing)
|
|
|
|
```go
|
|
Thing struct {
|
|
Member string //@Member
|
|
}
|
|
```
|
|
-- Thing-definition-json --
|
|
{
|
|
"span": {
|
|
"uri": "file://godef/a/d.go",
|
|
"start": {
|
|
"line": 5,
|
|
"column": 6,
|
|
"offset": 30
|
|
},
|
|
"end": {
|
|
"line": 5,
|
|
"column": 11,
|
|
"offset": 35
|
|
}
|
|
},
|
|
"description": "[`a.Thing` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a#Thing)\n\n```go\nThing struct {\n\tMember string //@Member\n}\n```"
|
|
}
|
|
|
|
-- Thing-hover --
|
|
[`a.Thing` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a#Thing)
|
|
|
|
```go
|
|
Thing struct {
|
|
Member string //@Member
|
|
}
|
|
```
|
|
-- Things-definition --
|
|
godef/a/d.go:11:6-12: defined here as [`a.Things` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a#Things)
|
|
|
|
```go
|
|
func Things(val []string) []Thing
|
|
```
|
|
-- Things-definition-json --
|
|
{
|
|
"span": {
|
|
"uri": "file://godef/a/d.go",
|
|
"start": {
|
|
"line": 11,
|
|
"column": 6,
|
|
"offset": 113
|
|
},
|
|
"end": {
|
|
"line": 11,
|
|
"column": 12,
|
|
"offset": 119
|
|
}
|
|
},
|
|
"description": "[`a.Things` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a#Things)\n\n```go\nfunc Things(val []string) []Thing\n```"
|
|
}
|
|
|
|
-- Things-hover --
|
|
[`a.Things` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a#Things)
|
|
|
|
```go
|
|
func Things(val []string) []Thing
|
|
```
|