Remove context sensitive let indentation when IndentPolicyLeft

Let expressions with multiple bindings automattically indent and pull
left

```
let
  a = b
  c = d
in foo bar baz
```

```
let
  a = b
  c = d
in
  foo bar baz
```

```
let
  a = b
  c = d
in foo
  bar
  baz
```

```
let
  a = b
  c = d
in
  foo
    bar
    baz
```
pull/66/head
Evan Rutledge Borden 2017-09-21 21:47:30 -04:00 committed by Lennart Spitzner
parent bdf8769913
commit ce41178df5
1 changed files with 57 additions and 20 deletions

View File

@ -567,7 +567,44 @@ layoutExpr lexpr@(L _ expr) = do
(docSetBaseY $ expDoc1) (docSetBaseY $ expDoc1)
] ]
] ]
Just bindDocs@(_:_) -> docAlt Just bindDocs@(_:_) -> docAlt $
case indentPolicy of
IndentPolicyLeft ->
--either
-- let
-- a = b
-- c = d
-- in foo
-- bar
-- baz
--or
-- let
-- a = b
-- c = d
-- in
-- fooooooooooooooooooo
[ docLines
[ docAddBaseY BrIndentRegular
$ docPar
(docLit $ Text.pack "let")
(docSetBaseAndIndent $ docLines $ return <$> bindDocs)
, docSeq
[ docLit $ Text.pack "in "
, docAddBaseY BrIndentRegular $ expDoc1
]
]
, docLines
[ docAddBaseY BrIndentRegular
$ docPar
(docLit $ Text.pack "let")
(docSetBaseAndIndent $ docLines $ return <$> bindDocs)
, docAddBaseY BrIndentRegular
$ docPar
(docLit $ Text.pack "in")
(docSetBaseY $ expDoc1)
]
]
_ ->
[ docLines [ docLines
[ docSeq [ docSeq
[ appSep $ docLit $ Text.pack "let" [ appSep $ docLit $ Text.pack "let"