1
0
mirror of https://github.com/golang/go synced 2024-10-01 12:48:33 -06:00
go/internal/lsp/testdata/folding/bad.go.golden
Francesco Renzi a3f652f180 tools/gopls: add cmd support for folding_ranges
This change adds command line support for foldingRange.
Provided with a file, it will display a list of folding
ranges within that file, with 1-indexed positions using
the format
{startingLine}:{startingChar}-{endingLine}:{endingChar}

Example:

$ gopls folding_ranges ~/tmp/foo/main.go
$
$ 3:9-6:0
$ 10:22-11:32
$ 12:10-12:9
$ 12:20-30:0

Updates golang/go#32875

Change-Id: Ib35cf26088736e7c35612d783c80be7ae41b6a70
Reviewed-on: https://go-review.googlesource.com/c/tools/+/206158
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-11-12 00:55:09 +00:00

92 lines
1.2 KiB
Plaintext

-- foldingRange-0 --
package folding //@fold("package")
import (<>)
import (<>)
// badBar is a function.
func badBar(<>) string {<>}
-- foldingRange-1 --
package folding //@fold("package")
import ( "fmt"
_ "log"
)
import (
_ "os" )
// badBar is a function.
func badBar() string { x := true
if x {<>} else {<>}
return
}
-- foldingRange-2 --
package folding //@fold("package")
import ( "fmt"
_ "log"
)
import (
_ "os" )
// badBar is a function.
func badBar() string { x := true
if x {
// This is the only foldable thing in this file when lineFoldingOnly
fmt.Println(<>)
} else {
fmt.Println(<>) }
return
}
-- foldingRange-cmd --
3:9-5:0
7:9-8:8
11:13-11:12
11:23-18:0
12:8-15:1
14:15-14:20
15:10-16:23
16:15-16:21
-- foldingRange-imports-0 --
package folding //@fold("package")
import (<>)
import (<>)
// badBar is a function.
func badBar() string { x := true
if x {
// This is the only foldable thing in this file when lineFoldingOnly
fmt.Println("true")
} else {
fmt.Println("false") }
return
}
-- foldingRange-lineFolding-0 --
package folding //@fold("package")
import ( "fmt"
_ "log"
)
import (
_ "os" )
// badBar is a function.
func badBar() string { x := true
if x {<>
} else {
fmt.Println("false") }
return
}