Skip to content

Indentation mode needs to be able to recover from parser errors #861

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
arybczak opened this issue Sep 10, 2015 · 2 comments
Closed

Indentation mode needs to be able to recover from parser errors #861

arybczak opened this issue Sep 10, 2015 · 2 comments

Comments

@arybczak
Copy link

If there is a parse error while trying to determine indentation (e.g. after pressing Enter), the mode completely breaks down. In the past it dropped to the beginning of the next line, currently the Enter key just stops working. This makes the whole mode unreliable to use.

My proposition is that it should be ensured that if the indentation breaks, the mode will still be more or less usable (at least that one is able to go to the next line) until it's able to work again (by getting out of the context it can't parse possibly, I'm not sure how it's implemented). As for the indentation level, I think the best course of action would be to just stay at the indentation level it's at when going to the next line (which is the right course of action the majority of time).

@gracjan gracjan changed the title indentation mode needs to be able to recover from parser errors Indentation mode needs to be able to recover from parser errors Sep 16, 2015
@Shimuuar
Copy link
Contributor

Yes this major usability problem. IMO enter should insert newline if indenter fails. There are always some weird corner case or plain invalid haskell which will cause parser errors so haskell-mode should fall back on some simpler heuristic

Shimuuar added a commit to Shimuuar/haskell-mode that referenced this issue Oct 17, 2015
Workaround for GH haskell#861. This is very hacky and rely on fact that
expression return string when parse fails and integer otherwise.
@gracjan
Copy link
Contributor

gracjan commented Oct 26, 2015

Closing in favor of #962.

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

3 participants