neovimhaskell/haskell-vim

Indentation with comment on previous line

cloudhead opened this issue · 3 comments

A general problem I'm seeing is that the indentation doesn't account for comments on the previous line. Example:

foo = doSomething 123  -- Do something important.
>>>>bar

bar will be indented &shiftwidth because of the operator on previous line rule, which is . here.

A nice solution for this would be to run all the checks as if the previous line didn't have a comment, as long as: a) we're not inputting a comment, and b) if there is a comment, it's not the only thing on the line.

Good point. This should be relatively easy, I have some working code here but I want to check for some edge cases before pushing it.

I've pushed a change to a new branch commentindentation. I'm only checking for trailing -- right now, trailing '{-' will follow once I've got the time ^^.

Nice! Going to try this out.