This test checks basic behavior of textDocument/foldingRange. -- a.go -- package folding //@foldingrange(raw) import ( "fmt" _ "log" ) import _ "os" // bar is a function. // With a multiline doc comment. func bar() string { /* This is a single line comment */ switch { case true: if true { fmt.Println("true") } else { fmt.Println("false") } case false: fmt.Println("false") default: fmt.Println("default") } /* This is a multiline block comment */ /* This is a multiline block comment */ // Followed by another comment. _ = []int{ 1, 2, 3, } _ = [2]string{"d", "e", } _ = map[string]int{ "a": 1, "b": 2, "c": 3, } type T struct { f string g int h string } _ = T{ f: "j", g: 4, h: "i", } x, y := make(chan bool), make(chan bool) select { case val := <-x: if val { fmt.Println("true from x") } else { fmt.Println("false from x") } case <-y: fmt.Println("y") default: fmt.Println("default") } // This is a multiline comment // that is not a doc comment. return ` this string is not indented` } -- @raw -- package folding //@foldingrange(raw) import (<0 kind="imports"> "fmt" _ "log" ) import _ "os" // bar is a function.<1 kind="comment"> // With a multiline doc comment. func bar(<2 kind="">) string {<3 kind=""> /* This is a single line comment */ switch {<4 kind=""> case true:<5 kind=""> if true {<6 kind=""> fmt.Println(<7 kind="">"true") } else {<8 kind=""> fmt.Println(<9 kind="">"false") } case false:<10 kind=""> fmt.Println(<11 kind="">"false") default:<12 kind=""> fmt.Println(<13 kind="">"default") } /* This is a multiline<14 kind="comment"> block comment */ /* This is a multiline<15 kind="comment"> block comment */ // Followed by another comment. _ = []int{<16 kind=""> 1, 2, 3, } _ = [2]string{<17 kind="">"d", "e", } _ = map[string]int{<18 kind=""> "a": 1, "b": 2, "c": 3, } type T struct {<19 kind=""> f string g int h string } _ = T{<20 kind=""> f: "j", g: 4, h: "i", } x, y := make(<21 kind="">chan bool), make(<22 kind="">chan bool) select {<23 kind=""> case val := <-x:<24 kind=""> if val {<25 kind=""> fmt.Println(<26 kind="">"true from x") } else {<27 kind=""> fmt.Println(<28 kind="">"false from x") } case <-y:<29 kind=""> fmt.Println(<30 kind="">"y") default:<31 kind=""> fmt.Println(<32 kind="">"default") } // This is a multiline comment<33 kind="comment"> // that is not a doc comment. return <34 kind="">` this string is not indented` }