mirror of
https://github.com/golang/go
synced 2024-11-19 03:34:41 -07:00
98df123772
This should provide simple name completions for comments above exported variables. Can be activated with `ctrl+space` within a comment. Pretty new, so all help is welcome. Fixes #34010 Change-Id: I1c8f71baa3beaa22ec5fd9fd4a531284a8d125f3 GitHub-Last-Rev: a9868eb69dc587cb4579268b2c3ae46932702641 GitHub-Pull-Request: golang/tools#166 Reviewed-on: https://go-review.googlesource.com/c/tools/+/197879 Reviewed-by: Rebecca Stambler <rstambler@golang.org>
80 lines
2.1 KiB
Go
80 lines
2.1 KiB
Go
package complit
|
|
|
|
// //@complete(" ", cVar)
|
|
var C string //@item(cVar, "C", "string", "var")
|
|
|
|
type position struct { //@item(structPosition, "position", "struct{...}", "struct")
|
|
X, Y int //@item(fieldX, "X", "int", "field"),item(fieldY, "Y", "int", "field")
|
|
}
|
|
|
|
func _() {
|
|
_ = position{
|
|
//@complete("", fieldX, fieldY, cVar, structPosition)
|
|
}
|
|
_ = position{
|
|
X: 1,
|
|
//@complete("", fieldY)
|
|
}
|
|
_ = position{
|
|
//@complete("", fieldX)
|
|
Y: 1,
|
|
}
|
|
_ = []*position{
|
|
{
|
|
//@complete("", fieldX, fieldY, cVar, structPosition)
|
|
},
|
|
}
|
|
}
|
|
|
|
func _() {
|
|
var (
|
|
aa string //@item(aaVar, "aa", "string", "var")
|
|
ab int //@item(abVar, "ab", "int", "var")
|
|
)
|
|
|
|
_ = map[int]int{
|
|
a: a, //@complete(":", abVar, aaVar),complete(",", abVar, aaVar)
|
|
}
|
|
|
|
_ = map[int]int{
|
|
//@complete("", abVar, aaVar, cVar, structPosition)
|
|
}
|
|
|
|
_ = []string{a: ""} //@complete(":", abVar, aaVar)
|
|
_ = [1]string{a: ""} //@complete(":", abVar, aaVar)
|
|
|
|
_ = position{X: a} //@complete("}", abVar, aaVar)
|
|
_ = position{a} //@complete("}", abVar, aaVar)
|
|
_ = position{a, } //@complete("}", abVar, aaVar, cVar, structPosition)
|
|
|
|
_ = []int{a} //@complete("a", abVar, aaVar, cVar, structPosition)
|
|
_ = [1]int{a} //@complete("a", abVar, aaVar, cVar, structPosition)
|
|
|
|
type myStruct struct {
|
|
AA int //@item(fieldAA, "AA", "int", "field")
|
|
AB string //@item(fieldAB, "AB", "string", "field")
|
|
}
|
|
|
|
_ = myStruct{
|
|
AB: a, //@complete(",", aaVar, abVar)
|
|
}
|
|
|
|
var s myStruct
|
|
|
|
_ = map[int]string{1: "" + s.A} //@complete("}", fieldAB, fieldAA)
|
|
_ = map[int]string{1: (func(i int) string { return "" })(s.A)} //@complete(")}", fieldAA, fieldAB)
|
|
_ = map[int]string{1: func() string { s.A }} //@complete(" }", fieldAA, fieldAB)
|
|
|
|
_ = position{s.A} //@complete("}", fieldAA, fieldAB)
|
|
|
|
var X int //@item(varX, "X", "int", "var")
|
|
_ = position{X} //@complete("}", fieldX, varX)
|
|
}
|
|
|
|
func _() {
|
|
_ := position{
|
|
X: 1, //@complete("X", fieldX),complete(" 1", cVar, structPosition)
|
|
Y: , //@complete(":", fieldY),complete(" ,", cVar, structPosition)
|
|
}
|
|
}
|