go/internal/lsp/source/completion
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
..
builtin.go internal/lsp/completion: fix untyped int type inference 2021-02-05 20:20:24 +00:00
completion.go internal/lsp/completion: move postfix completions behind option 2021-03-29 18:55:49 +00:00
deep_completion.go internal/lsp/source: handle nil pointer exception in completion 2020-11-14 22:40:30 +00:00
deep_completion_test.go internal/lsp/source: move completion to its own package 2020-09-08 19:19:08 +00:00
format.go internal/lsp/source: fix docs for fields of anonymous structs/interfaces 2021-03-30 03:09:04 +00:00
keywords.go internal/lsp/source/completion: remove "completion_" prefix from files 2020-10-30 17:45:15 +00:00
labels.go internal/lsp/source/completion: remove "completion_" prefix from files 2020-10-30 17:45:15 +00:00
literal.go internal/lsp/source/completion: add postfix snippet completions 2021-03-29 17:27:46 +00:00
package.go internal/lsp/source/completion: remove "completion_" prefix from files 2020-10-30 17:45:15 +00:00
postfix_snippets.go internal/lsp/source/completion: add postfix snippet completions 2021-03-29 17:27:46 +00:00
printf.go internal/lsp: fix some incorrect spelling 2020-11-24 11:59:21 +00:00
printf_test.go internal/lsp/source/completion: remove "completion_" prefix from files 2020-10-30 17:45:15 +00:00
snippet.go internal/lsp/source/completion: remove "completion_" prefix from files 2020-10-30 17:45:15 +00:00
statements.go internal/lsp: add snippet completion for t.Fatal errs 2021-03-15 21:39:02 +00:00
util.go internal/lsp/source/completion: add postfix snippet completions 2021-03-29 17:27:46 +00:00
util_test.go internal/lsp/source: move completion to its own package 2020-09-08 19:19:08 +00:00