Skip to content

Commit 7b0219c

Browse files
authored
Merge pull request #59 from Hi-Angel/fix-let-and-case-indentations
Don't check for Haskell's "curly braces" indentation
2 parents 530dc6d + 6ef23e7 commit 7b0219c

File tree

2 files changed

+42
-3
lines changed

2 files changed

+42
-3
lines changed

purescript-indentation.el

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -762,9 +762,7 @@ indent the current line. This has to be fixed elsewhere."
762762
(throw 'parse-end nil)))))
763763

764764
(defun purescript-indentation-layout (parser)
765-
(if (string= current-token "{")
766-
(purescript-indentation-list parser "}" ";" nil)
767-
(purescript-indentation-implicit-layout-list parser)))
765+
(purescript-indentation-implicit-layout-list parser))
768766

769767
(defun purescript-indentation-expression-token (token)
770768
(member token '("if" "let" "do" "case" "\\" "(" "[" "{" "::"

tests/purescript-indentation-tests.el

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,44 @@ foo = do
237237
identifier :: Array String <- function call
238238
_ <- another call
239239
pure unit"))
240+
241+
(ert-deftest let-in-separate-lines ()
242+
"Tests bug #12"
243+
(purescript-test-indentation "
244+
test1 a
245+
= let { x } = a
246+
in x"
247+
248+
"
249+
test1 a
250+
= let { x } = a
251+
in x"))
252+
253+
(ert-deftest case-of-separate-lines ()
254+
"Tests bug #12"
255+
(purescript-test-indentation "
256+
test3 a
257+
= case a of
258+
{ x: y }
259+
-> y"
260+
261+
"
262+
test3 a
263+
= case a of
264+
{ x: y }
265+
-> y"))
266+
267+
(ert-deftest comma-first-list-after-case-of ()
268+
"A comma-first list was getting misindented if goes after case-of"
269+
:expected-result :failed
270+
(purescript-test-indentation "
271+
fun = case _ of
272+
[ a
273+
, b ]
274+
"
275+
276+
"
277+
fun = case _ of
278+
[ a
279+
, b ]
280+
"))

0 commit comments

Comments
 (0)