Skip to content

Don't check for Haskell's "curly braces" indentation #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions purescript-indentation.el
Original file line number Diff line number Diff line change
Expand Up @@ -762,9 +762,7 @@ indent the current line. This has to be fixed elsewhere."
(throw 'parse-end nil)))))

(defun purescript-indentation-layout (parser)
(if (string= current-token "{")
(purescript-indentation-list parser "}" ";" nil)
(purescript-indentation-implicit-layout-list parser)))
(purescript-indentation-implicit-layout-list parser))

(defun purescript-indentation-expression-token (token)
(member token '("if" "let" "do" "case" "\\" "(" "[" "{" "::"
Expand Down
41 changes: 41 additions & 0 deletions tests/purescript-indentation-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,44 @@ foo = do
identifier :: Array String <- function call
_ <- another call
pure unit"))

(ert-deftest let-in-separate-lines ()
"Tests bug #12"
(purescript-test-indentation "
test1 a
= let { x } = a
in x"

"
test1 a
= let { x } = a
in x"))

(ert-deftest case-of-separate-lines ()
"Tests bug #12"
(purescript-test-indentation "
test3 a
= case a of
{ x: y }
-> y"

"
test3 a
= case a of
{ x: y }
-> y"))

(ert-deftest comma-first-list-after-case-of ()
"A comma-first list was getting misindented if goes after case-of"
:expected-result :failed
(purescript-test-indentation "
fun = case _ of
[ a
, b ]
"

"
fun = case _ of
[ a
, b ]
"))