-
Notifications
You must be signed in to change notification settings - Fork 347
haskell-indendation and guards #481
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
Comments
Does |
I have this set:
but nothing specific to haskell-mode. But shouldn't it indent based on previous guard automatically? |
|
New indentation from wip/hi2 doesn't fix this issue unfortunately: I am still not sure how this is supposed to be working — I am not convinced guards have to be inserted by a hotkey. In theory it should be pretty easy to detect a guard on the previous line and add an indentation stop right under it. |
Do I understand that the pink rectangle position is offered as indentation point when it should not be? Or do you want |
Sorry, the pink rectangle is just my cursor, I should have moved it before taking the screenshot. I was expecting the indentation position (one of) to be right under |
I think I now understand. So if you place the cursor at a line with a guard then it offers proper indentation position. But if you place the cursor on empty line below a line with a guard then it does not offer guard position as an option. There are a couple of ways to intepret this situation. As far as I understand most of emacs modes for other languages use 'electric' behvior, that is as soon as you insert '|' (guard) it gets indented properly. This could work in this case as there is exactly one available indentation position. |
If you consider code:
and now press TAB on line with the singe I'll close this specific issue about guards as similar problem appears when continuing lists or records or curly braced constructs. Someday we will be able to tackle this together. |
👍 to tackle this as soon as it can be ;-) |
Consider the following code:
If I put the cursor in the end of the last line and hit and then try to use to cycle through all indentation possibilities it would never align with the previous guard. Is this expected or a bug? How does haskell-indentation mode format guards?
The text was updated successfully, but these errors were encountered: