1
0
mirror of https://github.com/golang/go synced 2024-10-01 11:28:34 -06:00
go/internal/lsp/testdata/selector/selector.go.in
Heschi Kreinick 3f7dfa39cf internal/lsp: sort by label after score
I want to stop sorting unimported completions. We still want to show
users something reasonable, so use label as a tiebreaker for score in
the higher level completion function.

To maintain the current sorting, we need to adjust scores by search
depth (height?) for lexical completions. A few tests are really ties,
and need sorting in the test case.

Change-Id: Ie2d09fdcbebf6fda4ab33a2f16c579d12b0f26ad
Reviewed-on: https://go-review.googlesource.com/c/tools/+/212633
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-12-30 21:11:21 +00:00

66 lines
1.2 KiB
Go

// +build go1.11
package selector
import (
"golang.org/x/tools/internal/lsp/bar"
)
type S struct {
B, A, C int //@item(Bf, "B", "int", "field"),item(Af, "A", "int", "field"),item(Cf, "C", "int", "field")
}
func _() {
_ = S{}.; //@complete(";", Af, Bf, Cf)
}
type bob struct { a int } //@item(a, "a", "int", "field")
type george struct { b int }
type jack struct { c int } //@item(c, "c", "int", "field")
type jill struct { d int }
func (b *bob) george() *george {} //@item(george, "george", "func() *george", "method")
func (g *george) jack() *jack {}
func (j *jack) jill() *jill {} //@item(jill, "jill", "func() *jill", "method")
func _() {
b := &bob{}
y := b.george().
jack();
y.; //@complete(";", jill, c)
}
func _() {
bar. //@complete(" /", Bar)
x := 5
var b *bob
b. //@complete(" /", george, a)
y, z := 5, 6
b. //@complete(" /", george, a)
y, z, a, b, c := 5, 6
}
func _() {
bar. //@complete(" /", Bar)
bar.Bar()
bar. //@complete(" /", Bar)
go f()
}
func _() {
var b *bob
if y != b. //@complete(" /", george, a)
z := 5
if z + y + 1 + b. //@complete(" /", george, a)
r, s, t := 4, 5
if y != b. //@complete(" /", george, a)
z = 5
if z + y + 1 + b. //@complete(" /", george, a)
r = 4
}