Closed
Description
This is my idea/wish to address Node.js repl related issues.
-
Automatic multiline command mode has serious issues.
- Recoverable error guess is based on error message emitted by v8(vm specific) engine
(we may have to fix the code if vm emits different error string in next release) - False positives. We have to
.break
/^C
the expression to continue. - We can't reliably deduce the end of expression even if we build an incremental JS parser.
let echo = e => e; let x; x = echo(2); // 2 x = echo // both echo and echo\n(2) are completely valid expression (2) // 2
- Recoverable error guess is based on error message emitted by v8(vm specific) engine
-
No welcome message (it helps to see version number)
Proposal
- Welcome message with version and help guide
- Differentiate
execute
&continue
actions^M
or enter key to execute the command (current behavior)^J
to continue (Hand over the problem to user, let user decides it) building multiline expression.
Welcome message template
> node
Welcome to Node.js <<version>> (<<vm name>> VM, <<vm version>>)
Type ^M or enter to execute, ^J to continue, ^C to exit
Or try .help for help, more at https://nodejs.org/dist/v<<version>>/docs/api/repl.html
>
e.g.
> node
Welcome to Node.js 6.4.0 (v8 VM, 5.0.71.60)
Type ^M or enter to execute, ^J to continue, ^C to exit
Or try .help for help, more at https://nodejs.org/dist/v6.4.0/docs/api/repl.html
>
@nodejs/collaborators, I am happy to implement this if there is no objection
Note : Current system executes code when ^M
, ^J
or enter
pressed. ^I
or tab
for code completion