golang.org/x/tools/gopls@v0.15.3/internal/test/marker/testdata/completion/builtins.txt (about) 1 This test checks completion of Go builtins. 2 3 -- flags -- 4 -ignore_extra_diags 5 -filter_builtins=false 6 7 -- builtin_args.go -- 8 package builtins 9 10 func _() { 11 var ( 12 aSlice []int //@item(builtinSlice, "aSlice", "[]int", "var") 13 aMap map[string]int //@item(builtinMap, "aMap", "map[string]int", "var") 14 aString string //@item(builtinString, "aString", "string", "var") 15 aArray [0]int //@item(builtinArray, "aArray", "[0]int", "var") 16 aArrayPtr *[0]int //@item(builtinArrayPtr, "aArrayPtr", "*[0]int", "var") 17 aChan chan int //@item(builtinChan, "aChan", "chan int", "var") 18 aPtr *int //@item(builtinPtr, "aPtr", "*int", "var") 19 aInt int //@item(builtinInt, "aInt", "int", "var") 20 ) 21 22 type ( 23 aSliceType []int //@item(builtinSliceType, "aSliceType", "[]int", "type") 24 aChanType chan int //@item(builtinChanType, "aChanType", "chan int", "type") 25 aMapType map[string]int //@item(builtinMapType, "aMapType", "map[string]int", "type") 26 ) 27 28 close() //@rank(")", builtinChan, builtinSlice) 29 30 append() //@rank(")", builtinSlice, builtinChan) 31 32 var _ []byte = append([]byte(nil), ""...) //@rank(") //") 33 34 copy() //@rank(")", builtinSlice, builtinChan) 35 copy(aSlice, aS) //@rank(")", builtinSlice, builtinString) 36 copy(aS, aSlice) //@rank(",", builtinSlice, builtinString) 37 38 delete() //@rank(")", builtinMap, builtinChan) 39 delete(aMap, aS) //@rank(")", builtinString, builtinSlice) 40 41 aMapFunc := func() map[int]int { //@item(builtinMapFunc, "aMapFunc", "func() map[int]int", "var") 42 return nil 43 } 44 delete() //@rank(")", builtinMapFunc, builtinSlice) 45 46 len() //@rank(")", builtinSlice, builtinInt),rank(")", builtinMap, builtinInt),rank(")", builtinString, builtinInt),rank(")", builtinArray, builtinInt),rank(")", builtinArrayPtr, builtinPtr),rank(")", builtinChan, builtinInt) 47 48 cap() //@rank(")", builtinSlice, builtinMap),rank(")", builtinArray, builtinString),rank(")", builtinArrayPtr, builtinPtr),rank(")", builtinChan, builtinInt) 49 50 make() //@rank(")", builtinMapType, int),rank(")", builtinChanType, int),rank(")", builtinSliceType, int),rank(")", builtinMapType, int) 51 make(aSliceType, a) //@rank(")", builtinInt, builtinSlice) 52 53 type myInt int 54 var mi myInt //@item(builtinMyInt, "mi", "myInt", "var") 55 make(aSliceType, m) //@snippet(")", builtinMyInt, "mi") 56 57 var _ []int = make() //@rank(")", builtinSliceType, builtinMapType) 58 59 type myStruct struct{} //@item(builtinStructType, "myStruct", "struct{...}", "struct") 60 var _ *myStruct = new() //@rank(")", builtinStructType, int) 61 62 for k := range a { //@rank(" {", builtinSlice, builtinInt),rank(" {", builtinString, builtinInt),rank(" {", builtinChan, builtinInt),rank(" {", builtinArray, builtinInt),rank(" {", builtinArrayPtr, builtinInt),rank(" {", builtinMap, builtinInt), 63 } 64 65 for k, v := range a { //@rank(" {", builtinSlice, builtinChan) 66 } 67 68 <-a //@rank(" //", builtinChan, builtinInt) 69 } 70 71 -- builtin_types.go -- 72 package builtins 73 74 func _() { 75 var _ []bool //@item(builtinBoolSliceType, "[]bool", "[]bool", "type") 76 77 var _ []bool = make() //@rank(")", builtinBoolSliceType, int) 78 79 var _ []bool = make([], 0) //@rank(",", bool, int) 80 81 var _ [][]bool = make([][], 0) //@rank(",", bool, int) 82 } 83 84 -- builtins.go -- 85 package builtins 86 87 // Definitions of builtin completion items that are still used in tests. 88 89 /* bool */ //@item(bool, "bool", "", "type") 90 /* complex(r float64, i float64) */ //@item(complex, "complex", "func(r float64, i float64) complex128", "func") 91 /* float32 */ //@item(float32, "float32", "", "type") 92 /* float64 */ //@item(float64, "float64", "", "type") 93 /* imag(c complex128) float64 */ //@item(imag, "imag", "func(c complex128) float64", "func") 94 /* int */ //@item(int, "int", "", "type") 95 /* iota */ //@item(iota, "iota", "", "const") 96 /* string */ //@item(string, "string", "", "type") 97 /* true */ //@item(_true, "true", "", "const") 98 99 -- constants.go -- 100 package builtins 101 102 func _() { 103 const ( 104 foo = iota //@complete(" //", iota) 105 ) 106 107 iota //@complete(" //") 108 109 var iota int //@item(iotaVar, "iota", "int", "var") 110 111 iota //@complete(" //", iotaVar) 112 } 113 114 func _() { 115 var twoRedUpEnd bool //@item(TRUEVar, "twoRedUpEnd", "bool", "var") 116 117 var _ bool = true //@rank(" //", _true, TRUEVar) 118 }