Skip to content

prompt2 support and multi-line #1341

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 3 commits into from
May 31, 2016
Merged

prompt2 support and multi-line #1341

merged 3 commits into from
May 31, 2016

Conversation

fice-t
Copy link
Contributor

@fice-t fice-t commented May 27, 2016

There's a couple oddities still left, but I think this should improve the state of multi-line support in the REPL.

  • Adds a custom variable for prompt2 (multi-line prompt)
  • Highlights prompt2 when inside a multi-line block or in :set +m
  • haskell-interactive-mode-multi-line properly indents the multi-line expression (strips off whitespace in later lines)
  • C-j indents a bit more like you'd expect

Fixes #915
Fixes #1278

fice-t added 2 commits May 27, 2016 14:23
This expects the default prompt to end in "> " like in ghci. The
default prompt2 will then be as in ghci (ending in "| ").
* Using indent-relative explicitly disables some unwanted heuristics
  that indent-according-to-mode uses. I've found that this way is
  better, but it could certainly use improvement.

* Make haskell-interactive-mode-multi-line properly indent the
  expression.

* haskell-interactive-mode-cleanup-response is now useless as far as I
  can tell.
@gracjan
Copy link
Contributor

gracjan commented May 28, 2016

Looks nice. Will haskell-mode know if GHCi entered multiline mode? That could be useful to suspend for example company completions.

@fice-t
Copy link
Contributor Author

fice-t commented May 28, 2016

I couldn't find a direct way to do that, but one could perhaps check to see if the prompt2 was at the beginning of the line and use that information. Instead of just setting prompt2's font-lock property, one could also set an extra text property to make this easier.

That could go in a different PR I suppose.

@fice-t
Copy link
Contributor Author

fice-t commented May 28, 2016

@gracjan Though on second thought, I don't see much point in that. That doesn't help in cases like #1332 where it's not multi-line, but just in any IO action.

There's (haskell-process-evaluating-p (haskell-process)) that detects both that case and the multi-line case. It seems to be fast enough.

@gracjan gracjan merged commit 715d26e into haskell:master May 31, 2016
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

Successfully merging this pull request may close these issues.

2 participants