Skip to content
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

REPL .load multiline arrow function expressions #14022

Closed
rsxdalv opened this issue Jul 1, 2017 · 0 comments
Closed

REPL .load multiline arrow function expressions #14022

rsxdalv opened this issue Jul 1, 2017 · 0 comments
Labels
feature request Issues that request new features to be added to Node.js. repl Issues and PRs related to the REPL subsystem.

Comments

@rsxdalv
Copy link

rsxdalv commented Jul 1, 2017

There is no documented way of doing a .load in .editor style, causing multiline expressions (and JavaScript's implicit semicolons within a REPL) to break functions such as this:

const parseXlsx = (file) =>
    getFile(file)
        .then(data => xlsx.read(data))

(After getFile(file), the single line REPL will assume that the expression is done)

Proposal:
Combine .editor and .load into .load-editor or .load-multiline that loads the entire file before executing it. Possible workarounds - requiring the file and using exports, but that's reinventing .load. Alternatively, I'll attempt to minify the output, as that should reduce whitespace that has a special meaning in REPL single-line mode.

@vsemozhetbyt vsemozhetbyt added feature request Issues that request new features to be added to Node.js. repl Issues and PRs related to the REPL subsystem. labels Jul 1, 2017
robbinhan added a commit to robbinhan/node that referenced this issue Aug 15, 2017
robbinhan added a commit to robbinhan/node that referenced this issue Aug 15, 2017
robbinhan added a commit to robbinhan/node that referenced this issue Aug 15, 2017
robbinhan added a commit to robbinhan/node that referenced this issue Aug 15, 2017
@lance lance closed this as completed in 4bd44c1 Sep 1, 2017
addaleax pushed a commit to addaleax/ayo that referenced this issue Sep 5, 2017
The `.load` command would fail with any file that contains
multiline `.` operator expressions. This was particularly
noticeable when chaining promises or multi-line arrow
expressions.

This change Forces the REPL to be in `editorMode` while loading
a file from disk using the `.load` command.

Fixes: nodejs/node#14022

PR-URL: nodejs/node#14861
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
MylesBorins pushed a commit that referenced this issue Sep 10, 2017
The `.load` command would fail with any file that contains
multiline `.` operator expressions. This was particularly
noticeable when chaining promises or multi-line arrow
expressions.

This change Forces the REPL to be in `editorMode` while loading
a file from disk using the `.load` command.

Fixes: #14022

PR-URL: #14861
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
MylesBorins pushed a commit that referenced this issue Sep 12, 2017
The `.load` command would fail with any file that contains
multiline `.` operator expressions. This was particularly
noticeable when chaining promises or multi-line arrow
expressions.

This change Forces the REPL to be in `editorMode` while loading
a file from disk using the `.load` command.

Fixes: #14022

PR-URL: #14861
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
MylesBorins pushed a commit that referenced this issue Oct 10, 2017
The `.load` command would fail with any file that contains
multiline `.` operator expressions. This was particularly
noticeable when chaining promises or multi-line arrow
expressions.

This change Forces the REPL to be in `editorMode` while loading
a file from disk using the `.load` command.

Fixes: #14022

Backport-PR-URL: #15775
PR-URL: #14861
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
MylesBorins pushed a commit that referenced this issue Oct 25, 2017
The `.load` command would fail with any file that contains
multiline `.` operator expressions. This was particularly
noticeable when chaining promises or multi-line arrow
expressions.

This change Forces the REPL to be in `editorMode` while loading
a file from disk using the `.load` command.

Fixes: #14022

Backport-PR-URL: #15775
PR-URL: #14861
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

No branches or pull requests

2 participants