diff --git a/internal/lsp/source/completion.go b/internal/lsp/source/completion.go index 92b0c8e673..84e229ff04 100644 --- a/internal/lsp/source/completion.go +++ b/internal/lsp/source/completion.go @@ -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 ( diff --git a/internal/lsp/testdata/complit/complit.go.in b/internal/lsp/testdata/complit/complit.go.in index e01fdb6dc9..d3fd657e03 100644 --- a/internal/lsp/testdata/complit/complit.go.in +++ b/internal/lsp/testdata/complit/complit.go.in @@ -16,6 +16,11 @@ func _() { //@complete("", fieldX) Y: 1, } + _ = []*position{ + { + //@complete("", fieldX, fieldY, structPosition) + }, + } } func _() { diff --git a/internal/lsp/tests/tests.go b/internal/lsp/tests/tests.go index 5275a6d885..ac2e0c268c 100644 --- a/internal/lsp/tests/tests.go +++ b/internal/lsp/tests/tests.go @@ -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