neovimhaskell/haskell-vim

Indent bug with function definitions

cloudhead opened this issue · 3 comments

processEvent :: a -> a
processEvent rs =
    rs
processEvent rs| =         -- cursor is at |, we press <space>
    rs

It indents the function header due to the default/catchall rule:

processEvent :: a -> a
processEvent rs =
    rs
    processEvent rs | =
    rs

I don't see how to fix this. The indenter has no idea about the context here. If you happen to have an idea on how to do this without massive amounts of backtracking and parsing, patches welcome.

Well, locally what I did in the meantime is to change the default rule to return -1. I don't know what else that affects, but in general I'd say it's a better default to not indent, than to match indent.

I've removed the last 3 indent rules and the test suite still seems to pass. So I guess I'm going to risk it and push that change. If you happen to find anything that breaks in the wake of this change please report it so I can write a test case.