The line following a `let` in a `do` block should not be indented.
w9 opened this issue · comments
Right now after a complete let
statement in a do
block, a level of indentation is added for the next line:
main :: IO ()
main = do
let a = 1
█
This is not expected as let
statements in do
blocks don't need in
clauses.
If this is in case the programmer wants to type in more than one assignments in a single let
, then it is unexpected that re-indentation of the following block (using the =
key):
main :: IO ()
main = do
let a = 1
return ()
gives me a wrong indentation that doesn't even compile:
main :: IO ()
main = do
let a = 1
return ()
While this is true there is not easy way to detect that you are in a do
block other than doing backtracking which is rather expensive. Doing that with current Vim tools is not really feasible.
What's really annoying is that the indentation is often changed in cases like this where it was correct before. Is there a way to disable automatic indentation in this plugin? It makes it essentially unusable.
I've just merged #88 which introduces a flag to disable indentation, so you can use one that suits your style better.
Great, thanks!
You can actually get rid of this auto-indenting behavior (on latest master), with this new config setting:
let g:haskell_indent_let_no_in = 0
(See PR #98.)