go/internal/lsp/testdata/godef/a
Shoshin Nikita 769264cf08 internal/lsp/source: fix docs for fields of anonymous structs/interfaces
There are 2 different anonymous struct declarations that require
different approaches:

1. var x struct{...}
2. x := struct{...}{}

For the first one we can use the existing solution with a minor update.
However, it returns the wrong docs for the fields of nested structs.
To fix this we need to visit all fields recursively.

The second one is not a generic declaration. So, the simplest solution
is to use the method Snapshot.PosToField.

Fixes golang/go#43675

Change-Id: I46685e7985cbf2c1c5b1b74ef3cd3a70b920feba
GitHub-Last-Rev: 8a5704c2ecc3f8a007c00c7adcd637e56d99106c
GitHub-Pull-Request: golang/tools#284
Reviewed-on: https://go-review.googlesource.com/c/tools/+/300029
Trust: Rebecca Stambler <rstambler@golang.org>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2021-03-30 03:09:04 +00:00
..
a.go internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
a.go.golden internal/lsp: fix godef for embedded type aliases 2020-11-23 15:59:28 +00:00
a_test.go internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
a_test.go.golden internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
a_x_test.go internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
a_x_test.go.golden internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
d.go internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
d.go.golden internal/lsp: add ?utm_source=gopls to links to pkg.go.dev 2020-11-16 00:15:58 +00:00
f.go internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
f.go.golden internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
g.go internal/lsp: show human-readable const time.Duration as a comment 2021-03-03 20:04:07 +00:00
g.go.golden internal/lsp: show human-readable const time.Duration as a comment 2021-03-03 20:04:07 +00:00
h.go internal/lsp/source: fix docs for fields of anonymous structs/interfaces 2021-03-30 03:09:04 +00:00
h.go.golden internal/lsp/source: fix docs for fields of anonymous structs/interfaces 2021-03-30 03:09:04 +00:00
random.go internal/lsp: remove multi-module support in tests 2020-09-22 16:28:30 +00:00
random.go.golden internal/lsp: add ?utm_source=gopls to links to pkg.go.dev 2020-11-16 00:15:58 +00:00