tree-sitter / tree-sitter-go

Go grammar for tree-sitter
MIT License
310 stars 65 forks source link

indentexpr for switch case behaviour #102

Closed echoface closed 1 year ago

echoface commented 1 year ago

nvim 0.8.1 nvim-treesitter: latest indent behaviour wrong

details:

case 1: enable nvim-treesitter with go support set indentexpr? output => indentexpr=nvim_treesitter#indent()

func abc(v int) {
    switch v {
}
    switch {
}
    for {
        switch {
    }
    }
}

case 2: disable nvim-treesitter, everything going on well: (ps: filetype indent on)

func abc(v int) {
    switch v {

    }
    switch {
    }
    for {
        switch {
        }
    }
}

set indentexpr? output => indentexpr=GoIndent(v:lnum)

amaanq commented 1 year ago

That's an issue for nvim-treesitter, not tree-sitter-go