mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
internal/lsp/source: fixes completion for slice literals of pointers
The existing implementation did not suggest struct field names when running completion from within a slice literal of pointers. Now, struct field names are suggested in that case. Fixes golang/go#33211 Change-Id: I6028420a9a789846b070fcc6e45ec89dc4d898d4 Reviewed-on: https://go-review.googlesource.com/c/tools/+/192277 Reviewed-by: Rebecca Stambler <rstambler@golang.org> Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
311ec0312e
commit
2161848f5a
@ -765,7 +765,7 @@ func enclosingCompositeLiteral(path []ast.Node, pos token.Pos, info *types.Info)
|
||||
|
||||
clInfo := compLitInfo{
|
||||
cl: n,
|
||||
clType: tv.Type.Underlying(),
|
||||
clType: deref(tv.Type).Underlying(),
|
||||
}
|
||||
|
||||
var (
|
||||
|
5
internal/lsp/testdata/complit/complit.go.in
vendored
5
internal/lsp/testdata/complit/complit.go.in
vendored
@ -16,6 +16,11 @@ func _() {
|
||||
//@complete("", fieldX)
|
||||
Y: 1,
|
||||
}
|
||||
_ = []*position{
|
||||
{
|
||||
//@complete("", fieldX, fieldY, structPosition)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func _() {
|
||||
|
@ -29,7 +29,7 @@ import (
|
||||
// We hardcode the expected number of test cases to ensure that all tests
|
||||
// are being executed. If a test is added, this number must be changed.
|
||||
const (
|
||||
ExpectedCompletionsCount = 154
|
||||
ExpectedCompletionsCount = 155
|
||||
ExpectedCompletionSnippetCount = 15
|
||||
ExpectedDiagnosticsCount = 21
|
||||
ExpectedFormatCount = 6
|
||||
|
Loading…
x
Reference in New Issue
Block a user