golang.org/x/tools/gopls@v0.15.3/internal/test/marker/testdata/completion/danglingstmt.txt (about) 1 This test checks that completion works as expected in the presence of 2 incomplete statements that may affect parser recovery. 3 4 -- flags -- 5 -ignore_extra_diags 6 7 -- go.mod -- 8 module golang.org/lsptests/dangling 9 10 go 1.18 11 12 -- settings.json -- 13 { 14 "completeUnimported": false, 15 "deepCompletion": false 16 } 17 18 -- dangling_for.go -- 19 package danglingstmt 20 21 func _() { 22 for bar //@rank(" //", danglingBar) 23 } 24 25 func bar() bool { //@item(danglingBar, "bar", "func() bool", "func") 26 return true 27 } 28 29 -- dangling_for_init.go -- 30 package danglingstmt 31 32 func _() { 33 for i := bar //@rank(" //", danglingBar2) 34 } 35 36 func bar2() int { //@item(danglingBar2, "bar2", "func() int", "func") 37 return 0 38 } 39 40 -- dangling_for_init_cond.go -- 41 package danglingstmt 42 43 func _() { 44 for i := bar3(); i > bar //@rank(" //", danglingBar3) 45 } 46 47 func bar3() int { //@item(danglingBar3, "bar3", "func() int", "func") 48 return 0 49 } 50 51 -- dangling_for_init_cond_post.go -- 52 package danglingstmt 53 54 func _() { 55 for i := bar4(); i > bar4(); i += bar //@rank(" //", danglingBar4) 56 } 57 58 func bar4() int { //@item(danglingBar4, "bar4", "func() int", "func") 59 return 0 60 } 61 62 -- dangling_if.go -- 63 package danglingstmt 64 65 func _() { 66 if foo //@rank(" //", danglingFoo) 67 } 68 69 func foo() bool { //@item(danglingFoo, "foo", "func() bool", "func") 70 return true 71 } 72 73 -- dangling_if_eof.go -- 74 package danglingstmt 75 76 func bar5() bool { //@item(danglingBar5, "bar5", "func() bool", "func") 77 return true 78 } 79 80 func _() { 81 if b //@rank(" //", danglingBar5) 82 83 -- dangling_if_init.go -- 84 package danglingstmt 85 86 func _() { 87 if i := foo //@rank(" //", danglingFoo2) 88 } 89 90 func foo2() bool { //@item(danglingFoo2, "foo2", "func() bool", "func") 91 return true 92 } 93 94 -- dangling_if_init_cond.go -- 95 package danglingstmt 96 97 func _() { 98 if i := 123; foo //@rank(" //", danglingFoo3) 99 } 100 101 func foo3() bool { //@item(danglingFoo3, "foo3", "func() bool", "func") 102 return true 103 } 104 105 -- dangling_multiline_if.go -- 106 package danglingstmt 107 108 func walrus() bool { //@item(danglingWalrus, "walrus", "func() bool", "func") 109 return true 110 } 111 112 func _() { 113 if true && 114 walrus //@complete(" //", danglingWalrus) 115 } 116 117 -- dangling_selector_1.go -- 118 package danglingstmt 119 120 func _() { 121 x. //@rank(" //", danglingI) 122 } 123 124 var x struct { i int } //@item(danglingI, "i", "int", "field") 125 126 -- dangling_selector_2.go -- 127 package danglingstmt 128 129 // TODO: re-enable this test, which was broken when the foo package was removed. 130 // (we can replicate the relevant definitions in the new marker test) 131 // import "golang.org/lsptests/foo" 132 133 func _() { 134 foo. // rank(" //", Foo) 135 var _ = []string{foo.} // rank("}", Foo) 136 } 137 138 -- dangling_switch_init.go -- 139 package danglingstmt 140 141 func _() { 142 switch i := baz //@rank(" //", danglingBaz) 143 } 144 145 func baz() int { //@item(danglingBaz, "baz", "func() int", "func") 146 return 0 147 } 148 149 -- dangling_switch_init_tag.go -- 150 package danglingstmt 151 152 func _() { 153 switch i := 0; baz //@rank(" //", danglingBaz2) 154 } 155 156 func baz2() int { //@item(danglingBaz2, "baz2", "func() int", "func") 157 return 0 158 }