-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.Issues related to the Go language server, gopls.
Milestone
Description
gopls version: gopls@e751756
(master
branch)
Fold calls to sort.Slice
and fmt.Println
in VSCode (or, likely, any other editor with LineFoldingOnly
set to true
):
func _() {
slice := []int{1, 2, 3}
sort.Slice(slice, func(i, j int) bool {
a, b := slice[i], slice[j]
return a < b
})
sort.Slice(
slice,
func(i, j int) bool {
return slice[i] < slice[j]
},
)
fmt.Println(
1, 2, 3,
4,
)
}
Not only the arguments but also the closing parentheses are being folded. There are several issues with this behavior:
- Lack of the closing parenthesis makes code editing more difficult. For example, users have to unfold
fmt.Println
to add more code. This behavior is particularly frustrating when working with calls liket.Run
. - It is inconsistent with the folding of function bodies and composite literals -
}
is always visible.
Current behavior | Expected behavior |
---|---|
![]() |
![]() |
Metadata
Metadata
Assignees
Labels
ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.Issues related to the Go language server, gopls.