1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
package complit
// general completions
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, structPosition)
}
_ = position{
X: 1,
//@complete("", fieldY)
}
_ = position{
//@complete("", fieldX)
Y: 1,
}
_ = []*position{
{
//@complete("", fieldX, fieldY, 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, 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, structPosition)
_ = []int{a} //@complete("}", abVar, aaVar)
_ = [1]int{a} //@complete("}", abVar, aaVar)
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 _() {
type foo struct{} //@item(complitFoo, "foo", "struct{...}", "struct")
var _ *foo = &fo{} //@snippet("{", complitFoo, "foo", "foo")
var _ *foo = fo{} //@snippet("{", complitFoo, "&foo", "&foo")
struct { a, b *foo }{
a: &fo{}, //@rank("{", complitFoo)
b: fo{}, //@snippet("{", complitFoo, "&foo", "&foo")
}
}
func _() {
_ := position{
X: 1, //@complete("X", fieldX),complete(" 1", structPosition)
Y: , //@complete(":", fieldY),complete(" ,", structPosition)
}
}
|