Skip to content

Can't fold conditional statement blocks #16

@kunev

Description

@kunev

When the cursor is inside an if/else or switch with foldmethod set to syntax the surrounding function actually gets folded instead of the conditional block itself.

Example:

func main() {
    a := "a"
    b := "b"

    if (true) {
        fmt.Println(a)  
        // ^- cursor being here should fold just the `if` or at least both the `if` and `else`
        // due to the `else` being on the same line as the `if`'s closing `}`.
        // However it folds the whole function. 
    } else {
        fmt.Println(b)
    }

    fmt.Println("end")
}

With the plugin disabled this folding works correct. I tried to work around that by setting g:go_syntax_fold to 0, hoping that would end up falling back to vim-go's folding, however it just disables syntax folding altogether.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions