gopls version: gopls@974c859 (master)

CL https://go.dev/cl/694295 changed the folding logic and reintroduced behavior reported and fixed in #70467:

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 like t.Run.

Also, there's a conflict between gopls' and VSCode's logic that makes this issue extremely annoying.

https://github.com/user-attachments/assets/dceac088-22c2-447b-90f9-20fcae449f20

Code snippet from the video
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,
    )
}

func TestA(t *testing.T) {
    t.Run("add", func(t *testing.T) {
        _ = 1 + 1
    })

    t.Run("sub", func(t *testing.T) {
        _ = 1 - 1
    })
}

func TestB(t *testing.T) {
    _ = 123
}

Comment From: gabyhelp

Related Issues

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

Comment From: madelinekalil

cc @pjweinb

Comment From: pjweinb

Thank you for the report. I agree that closing )s should be visible. I'll look into it.