1
0
mirror of https://github.com/golang/go synced 2024-10-01 16:28:33 -06:00
go/internal/lsp/testdata/assign/assign.go.in
Muir Manders 7bd96bd597 internal/lsp/source: improve completion in value spec
If the enclosing value spec specifies a type on the LHS, we now prefer
completions of that type on the RHS. For example:

i := 123
var foo int = // prefer "i" since we know we want an int

I also added a special case to lexical() to know that we can't offer
objects defined on the LHS as completions on the RHS. For example:

var foo int = // don't offer "foo" as completion

Change-Id: I8e24245a2bc86a29887360e7f642a4cbb87fa6ca
Reviewed-on: https://go-review.googlesource.com/c/tools/+/212401
Run-TryBot: Muir Manders <muir@mnd.rs>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-12-23 21:16:02 +00:00

16 lines
314 B
Go

package assign
func _() {
var (
myInt int //@item(assignInt, "myInt", "int", "var")
myStr string //@item(assignStr, "myStr", "string", "var")
)
var _ string = my //@rank(" //", assignStr, assignInt)
var _ string = //@rank(" //", assignStr, assignInt)
}
func _() {
var a string = a //@complete(" //")
}