reasonml / reasonml/reason

Make rtop behavior match common consoles.

Open
#92 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Rtop SKILL: EASY
Dominant language
OCaml
Stars
10.3k
Forks
438
PR merge metrics
No merged PRs in 30d

Description

The <CR> behavior should match that of the Chrome console.

  • When hitting cr, it should submit whatever you have (even if it's invalid syntax), while shift+cr should insert a newline (it's not clear this is possible, but it would be awesome). This would match the Chrome REPL and also Slack/Messenger!
  • Pasting multiple lines doesn't seem to work in rtop (at least with iTerm).
  • It would be great if hitting c-c would cancel whatever command you're in the middle of editing, but it would also tell you "hit c-c again to exit". Right now, you have to type exit 0; which is kind of annoying.
  • It would be good to print the errors using BetterErrors.
  • Currently, I believe the REPL will accept any entry if it is a valid parse, when you hit <CR>. That's bad if your cursor is in in the middle of a currently valid parse, but you want to insert a newline anyways (to add a new field etc). For example, your cursor is after x, and you want to hit enter to insert a newline.
let something = {
  field: x
};
  • Note that it may be impossible to distinguish shift+cr from cr in the terminal. However, the main important feature is that there's a way to distinguish between "submit what I have entered" vs. "I want to force a newline in the input". cr to submit, and shift+cr to force a newline would be ideal, but it may not be possible in the terminal. Instead, perhaps we use cr and ctrl+cr instead?

In general, more people know how to use the Chrome REPL (of Slack for that matter) than any other REPL, so let's just match that (or are there any other popular REPLs that you know of that do a really great job?)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the rtop terminal input handling and reproduce the CR, multiline paste, and C-C cases described for iTerm. Trace how input is parsed and submitted, including the requested BetterErrors output. Done means the agreed submit/newline, paste, cancellation, and error-display behaviors are implemented and verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
cli, developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.