Skip to content

No indentation suggested for case clauses #786

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

Closed
dzhus opened this issue Jul 29, 2015 · 6 comments
Closed

No indentation suggested for case clauses #786

dzhus opened this issue Jul 29, 2015 · 6 comments

Comments

@dzhus
Copy link

dzhus commented Jul 29, 2015

I'm experiencing broken indentation for case keyword clauses with haskell-mode version 13.15-git (/home/dzhus/.emacs.d/elpa/haskell-mode-20150729.316/)

Minimal example:

f x =
  case x of
    Just 5 -> return ()

When I hit TAB on the line with Just, it suggests to line it up with case:

f x =
  case x of
  Just 5 -> return ()

Here's an illustration of the problem with «Show indentations» option switched on:

2015-07-30-001022_1280x800_scrot

The rest of the options in haskell-indentation group are set to standard.

@gracjan
Copy link
Contributor

gracjan commented Sep 4, 2015

Hmm, technically this is correct in current implementation of haskell-indentation. The point is that clause after of may be empty and Just may start a new statement. haskell-indentation does not look past the first token on the line you are indenting.

I see how this might be confusing though... just not sure how to improve given current indentation design.

@dzhus
Copy link
Author

dzhus commented Sep 4, 2015

Thanks for the explanation. However, a there's an equal possibility that there is a clause after the case line (and this is usually the case in the wild with actual Haskell code). It should be possible to cycle through indentation options with TAB.

haskell-indentation does not look past the first token on the line you are indenting.

I believe in this case we should look at the line before the current line? And how is this different from case line being indented after f x?

@gracjan
Copy link
Contributor

gracjan commented Sep 4, 2015

Hmm, I think I misunderstood your comment.

To clarify: I get BOTH indentation points proposed. Do you get something else?

@dzhus
Copy link
Author

dzhus commented Sep 4, 2015

Yes, I am only suggested to have my Just 5 aligned on the same column as case. I cannot cycle with TAB to actually indent the Just 5 line.

@gracjan
Copy link
Contributor

gracjan commented Sep 4, 2015

That is interesting. Are you using haskell-indentation or something else? The latest github version or other version?

@gracjan
Copy link
Contributor

gracjan commented Oct 16, 2015

To my best knowledge this is working correctly. Reopen if you check against latest github version of haskell-indentation mode and it does not work.

@gracjan gracjan closed this as completed Oct 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants