repl: Add editor mode support#7275
Conversation
|
I think this change needs to be voted on or at least discussed first - but personally I'm in favor - thanks for the contribution! |
|
Can you add a test for paste mode? Existing |
a3a13dd to
0543975
Compare
|
@Trott Done! |
|
/cc @Fishrock123 |
test/parallel/test-repl-.paste.js
Outdated
There was a problem hiding this comment.
This code looks strange because of the indentation. Maybe change it to string concatenations.
0543975 to
542e270
Compare
|
The doc could probably use some information about what paste mode is. |
|
Based on |
Keep in mind that more of us have touched the internal module. I probably won't get to taking a look soon, but I'll leave my assignee as a self reminder for now. |
lib/repl.js
Outdated
There was a problem hiding this comment.
This should probably line up with e instanceof Recoverable…
542e270 to
b837360
Compare
lib/repl.js
Outdated
There was a problem hiding this comment.
better as a .prototype method?
|
Could someone elaborate on the benefits of this vs just normally pasting? Is it because you can edit the paste? |
|
b837360 to
0d1ef06
Compare
|
@princejwesley Shouldn't tab completion still work? Sounds like I should give this a try. I'm not so sure |
|
@Fishrock123 Yes. |
0d1ef06 to
482a4fe
Compare
|
CI is green |
|
@princejwesley To confirm, there's nothing here that checks for tab press anymore (i.e. would conflict with #7754)? |
|
@trevnorris Good point. I'll pull the patch and test locally. |
```js
> node
> .editor
// Entering editor mode (^D to finish, ^C to cancel)
function test() {
console.log('tested!');
}
test();
// ^D
tested!
undefined
>
```
caf100a to
370616c
Compare
|
Irrelevant CI failures: #3520, #3626, #3550 @Fishrock123 |
|
New run to see if we can get all green... https://ci.nodejs.org/job/node-test-pull-request/3551/ |
|
@jasnell CI is green |
|
Woo! 😀 LGTM, let's land it |
```js
> node
> .editor
// Entering editor mode (^D to finish, ^C to cancel)
function test() {
console.log('tested!');
}
test();
// ^D
tested!
undefined
>
```
PR-URL: #7275
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
|
Landed in b779eb42 |
```js
> node
> .editor
// Entering editor mode (^D to finish, ^C to cancel)
function test() {
console.log('tested!');
}
test();
// ^D
tested!
undefined
>
```
PR-URL: #7275
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Notable changes: * build: zlib symbols and additional OpenSSL symbols are now exposed on Windows platforms. (Alex Hultman) #7983 and #7576 * child_process, cluster: Forked child processes and cluster workers now support stdio configuration. (Colin Ihrig) #7811 and #7838 * fs: fs.ReadStream now exposes the number of bytes it has read so far. (Linus Unnebäck) #7942 * repl: The REPL now supports editor mode. (Prince J Wesley) #7275 * util: inspect() can now be configured globally using util.inspect.defaultOptions. (Roman Reiss) #8013 Refs: #8020 PR-URL: #8070
Notable changes: * build: zlib symbols and additional OpenSSL symbols are now exposed on Windows platforms. (Alex Hultman) #7983 and #7576 * child_process, cluster: Forked child processes and cluster workers now support stdio configuration. (Colin Ihrig) #7811 and #7838 * child_process: argv[0] can now be set to arbitrary values in spawned processes. (Pat Pannuto) #7696 * fs: fs.ReadStream now exposes the number of bytes it has read so far. (Linus Unnebäck) #7942 * repl: The REPL now supports editor mode. (Prince J Wesley) #7275 * util: inspect() can now be configured globally using util.inspect.defaultOptions. (Roman Reiss) #8013 Refs: #8020 PR-URL: #8070
Notable changes: * build: zlib symbols and additional OpenSSL symbols are now exposed on Windows platforms. (Alex Hultman) #7983 and #7576 * child_process, cluster: Forked child processes and cluster workers now support stdio configuration. (Colin Ihrig) #7811 and #7838 * child_process: argv[0] can now be set to arbitrary values in spawned processes. (Pat Pannuto) #7696 * fs: fs.ReadStream now exposes the number of bytes it has read so far. (Linus Unnebäck) #7942 * repl: The REPL now supports editor mode. (Prince J Wesley) #7275 * util: inspect() can now be configured globally using util.inspect.defaultOptions. (Roman Reiss) #8013 Refs: #8020 PR-URL: #8070
Notable changes: * build: zlib symbols and additional OpenSSL symbols are now exposed on Windows platforms. (Alex Hultman) nodejs#7983 and nodejs#7576 * child_process, cluster: Forked child processes and cluster workers now support stdio configuration. (Colin Ihrig) nodejs#7811 and nodejs#7838 * child_process: argv[0] can now be set to arbitrary values in spawned processes. (Pat Pannuto) nodejs#7696 * fs: fs.ReadStream now exposes the number of bytes it has read so far. (Linus Unnebäck) nodejs#7942 * repl: The REPL now supports editor mode. (Prince J Wesley) nodejs#7275 * util: inspect() can now be configured globally using util.inspect.defaultOptions. (Roman Reiss) nodejs#8013 Refs: nodejs#8020 PR-URL: nodejs#8070
|
Sorry, a bit late to the issue because I just found it in the release notes. As I understand it this feature is strictly about delaying the execution of the command until you're done entering all the lines? I was hoping when I saw the feature name that it would allow me to fix previous lines if I make an error, but it seems once I hit enter that I can't go back. |
|
Yeah, that was my first impression too, maybe because it is called .editor. Probably .paste would create less confusion. |
Checklist
make -j4 test(UNIX) orvcbuild test nosign(Windows) passesAffected core subsystem(s)
repl, doc
Description of change
Enabling
pasteeditor mode support for REPL (inspired byscalaREPL).