| package complit |
| |
| // exported comment completions |
| |
| // //@complete(" ", cVar) |
| var C string //@item(cVar, "C", "string", "var") |
| |
| // //@complete(" ", exportedConst) |
| const ExportedConst = "example" //@item(exportedConst, "ExportedConst", "string", "const") |
| |
| // //@complete(" ", exportedType) |
| type ExportedType struct { //@item(exportedType, "ExportedType", "struct{...}", "struct") |
| } |
| |
| // //@complete(" ", exportedFunc) |
| func ExportedFunc() int { //@item(exportedFunc, "ExportedFunc", "func() int", "func") |
| return 0 |
| } |
| |
| // This tests multiline block comments and completion with prefix |
| // Lorem Ipsum Multi//@complete(" ", multilineWithPrefix) |
| // Lorem ipsum dolor sit ametom |
| func MultilineWithPrefix() int { //@item(multilineWithPrefix, "MultilineWithPrefix", "func() int", "func") |
| return 0 |
| } |
| |
| // 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, exportedFunc, multilineWithPrefix, structPosition, cVar, exportedConst, exportedType) |
| } |
| _ = position{ |
| X: 1, |
| //@complete("", fieldY) |
| } |
| _ = position{ |
| //@complete("", fieldX) |
| Y: 1, |
| } |
| _ = []*position{ |
| { |
| //@complete("", fieldX, fieldY, exportedFunc, multilineWithPrefix, structPosition, cVar, exportedConst, exportedType) |
| }, |
| } |
| } |
| |
| 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, exportedFunc, multilineWithPrefix, aaVar, structPosition, cVar, exportedConst, exportedType) |
| } |
| |
| _ = []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, exportedFunc, multilineWithPrefix, aaVar, structPosition, cVar, exportedConst, exportedType) |
| |
| _ = []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", exportedFunc, multilineWithPrefix, structPosition, cVar, exportedConst, exportedType) |
| Y: , //@complete(":", fieldY),complete(" ,", exportedFunc, multilineWithPrefix, structPosition, cVar, exportedConst, exportedType) |
| } |
| } |