Skip to content

Commit 1d108f2

Browse files
committed
Don't check for Haskell's "curly braces" indentation
PureScript doesn't support "curly braces" mode as Haskell does, so the only thing the code did was introducing some bug where mixing let-in and case-of statements were breaking indentation. Credits to @purefunctor for the solution. Fixes: #12
1 parent 530dc6d commit 1d108f2

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-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: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,29 @@ 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"))

0 commit comments

Comments
 (0)