Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.0.0-20201105173854-bc9fc8d8c4bc / internal / lsp / testdata / complit / complit.go.in
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.0.0-20201105173854-bc9fc8d8c4bc/internal/lsp/testdata/complit/complit.go.in b/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.0.0-20201105173854-bc9fc8d8c4bc/internal/lsp/testdata/complit/complit.go.in
new file mode 100644 (file)
index 0000000..c888c01
--- /dev/null
@@ -0,0 +1,92 @@
+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")
+
+       "&foo" //@item(complitAndFoo, "&foo", "struct{...}", "struct")
+
+       var _ *foo = &fo{} //@rank("{", complitFoo)
+       var _ *foo = fo{} //@rank("{", complitAndFoo)
+
+       struct { a, b *foo }{
+               a: &fo{}, //@rank("{", complitFoo)
+               b: fo{}, //@rank("{", complitAndFoo)
+       }
+}
+
+func _() {
+       _ := position{
+               X: 1, //@complete("X", fieldX),complete(" 1", structPosition)
+               Y: ,  //@complete(":", fieldY),complete(" ,", structPosition)
+       }
+}