golang.org/x/tools/gopls@v0.15.3/internal/test/marker/testdata/foldingrange/a_lineonly.txt (about) 1 This test checks basic behavior of the textDocument/foldingRange, when the 2 editor only supports line folding. 3 4 -- capabilities.json -- 5 { 6 "textDocument": { 7 "foldingRange": { 8 "lineFoldingOnly": true 9 } 10 } 11 } 12 -- a.go -- 13 package folding //@foldingrange(raw) 14 15 import ( 16 "fmt" 17 _ "log" 18 ) 19 20 import _ "os" 21 22 // bar is a function. 23 // With a multiline doc comment. 24 func bar() string { 25 /* This is a single line comment */ 26 switch { 27 case true: 28 if true { 29 fmt.Println("true") 30 } else { 31 fmt.Println("false") 32 } 33 case false: 34 fmt.Println("false") 35 default: 36 fmt.Println("default") 37 } 38 /* This is a multiline 39 block 40 comment */ 41 42 /* This is a multiline 43 block 44 comment */ 45 // Followed by another comment. 46 _ = []int{ 47 1, 48 2, 49 3, 50 } 51 _ = [2]string{"d", 52 "e", 53 } 54 _ = map[string]int{ 55 "a": 1, 56 "b": 2, 57 "c": 3, 58 } 59 type T struct { 60 f string 61 g int 62 h string 63 } 64 _ = T{ 65 f: "j", 66 g: 4, 67 h: "i", 68 } 69 x, y := make(chan bool), make(chan bool) 70 select { 71 case val := <-x: 72 if val { 73 fmt.Println("true from x") 74 } else { 75 fmt.Println("false from x") 76 } 77 case <-y: 78 fmt.Println("y") 79 default: 80 fmt.Println("default") 81 } 82 // This is a multiline comment 83 // that is not a doc comment. 84 return ` 85 this string 86 is not indented` 87 } 88 -- @raw -- 89 package folding //@foldingrange(raw) 90 91 import (<0 kind="imports"> 92 "fmt" 93 _ "log"</0> 94 ) 95 96 import _ "os" 97 98 // bar is a function.<1 kind="comment"> 99 // With a multiline doc comment.</1> 100 func bar() string {<2 kind=""> 101 /* This is a single line comment */ 102 switch {<3 kind=""> 103 case true:<4 kind=""> 104 if true {<5 kind=""> 105 fmt.Println("true")</5> 106 } else {<6 kind=""> 107 fmt.Println("false")</6> 108 }</4> 109 case false:<7 kind=""> 110 fmt.Println("false")</7> 111 default:<8 kind=""> 112 fmt.Println("default")</3></8> 113 } 114 /* This is a multiline<9 kind="comment"> 115 block 116 comment */</9> 117 118 /* This is a multiline<10 kind="comment"> 119 block 120 comment */ 121 // Followed by another comment.</10> 122 _ = []int{<11 kind=""> 123 1, 124 2, 125 3</11>, 126 } 127 _ = [2]string{"d", 128 "e", 129 } 130 _ = map[string]int{<12 kind=""> 131 "a": 1, 132 "b": 2, 133 "c": 3</12>, 134 } 135 type T struct {<13 kind=""> 136 f string 137 g int 138 h string</13> 139 } 140 _ = T{<14 kind=""> 141 f: "j", 142 g: 4, 143 h: "i"</14>, 144 } 145 x, y := make(chan bool), make(chan bool) 146 select {<15 kind=""> 147 case val := <-x:<16 kind=""> 148 if val {<17 kind=""> 149 fmt.Println("true from x")</17> 150 } else {<18 kind=""> 151 fmt.Println("false from x")</18> 152 }</16> 153 case <-y:<19 kind=""> 154 fmt.Println("y")</19> 155 default:<20 kind=""> 156 fmt.Println("default")</15></20> 157 } 158 // This is a multiline comment<21 kind="comment"> 159 // that is not a doc comment.</21> 160 return <22 kind="">` 161 this string 162 is not indented`</2></22> 163 }