1
0
mirror of https://github.com/golang/go synced 2024-11-19 02:04:42 -07:00
go/internal/lsp/testdata/labels/labels.go
Muir Manders 8f1b74eef3 internal/lsp: fix label completion in range and type switch stmts
Fix label detection to know about *ast.RangeStmt
and *ast.TypeSwitchStmt.

Change-Id: I4061e165884f7064fe486249fe3664d572b7b628
Reviewed-on: https://go-review.googlesource.com/c/tools/+/202621
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-22 21:33:09 +00:00

50 lines
897 B
Go

package labels
func _() {
goto F //@complete(" //", label1, label5)
Foo1: //@item(label1, "Foo1", "label", "const")
for a, b := range []int{} {
Foo2: //@item(label2, "Foo2", "label", "const")
switch {
case true:
break F //@complete(" //", label2, label1)
continue F //@complete(" //", label1)
{
FooUnjumpable:
}
goto F //@complete(" //", label1, label2, label4, label5)
func() {
goto F //@complete(" //", label3)
break F //@complete(" //")
continue F //@complete(" //")
Foo3: //@item(label3, "Foo3", "label", "const")
}()
}
Foo4: //@item(label4, "Foo4", "label", "const")
switch interface{}(a).(type) {
case int:
break F //@complete(" //", label4, label1)
}
}
break F //@complete(" //")
continue F //@complete(" //")
Foo5: //@item(label5, "Foo5", "label", "const")
for {
break F //@complete(" //", label5)
}
return
}