1
0
mirror of https://github.com/golang/go synced 2024-11-18 19:34:41 -07:00
go/internal/lsp/testdata/snippets
Muir Manders 02335f11d5 internal/lsp: don't qualify literal candidates in *ast.SelectorExpr
Previously we unconditionally qualified literal candidate types with
their package. For example:

var buf *bytes.Buffer
buf = &bytes.Bu<>

would complete to:

buf = &bytes.bytes.Buffer{}

Now we don't qualify the type if the cursor position is in the
selector of an *ast.SelectorExpr. We only generate literal candidates
for type names, so if we are in a selector then we can assume it is a
package qualified type (as opposed to an object field).

We also handle the insertion of "&" for literal pointers better. If you are in
the selector of an *ast.SelectorExpr, we prepend the "&" to the beginning of the
expression rather than the selector. For example, you will end up with
"&bytes.Buffer{}" instead of "bytes.&Buffer{}".

Updates golang/go#34872.

Change-Id: I812aa809cd4e649a429853386789f80033412814
Reviewed-on: https://go-review.googlesource.com/c/tools/+/201200
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-16 23:29:27 +00:00
..
literal_snippets.go.in internal/lsp: don't qualify literal candidates in *ast.SelectorExpr 2019-10-16 23:29:27 +00:00
snippets.go.in internal/lsp: don't overwrite suffix when inserting completion 2019-10-02 20:07:45 +00:00