-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
repl: support previews by eager evaluating input #30811
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,7 +98,8 @@ const experimentalREPLAwait = require('internal/options').getOptionValue( | |
| ); | ||
| const { | ||
| isRecoverableError, | ||
| kStandaloneREPL | ||
| kStandaloneREPL, | ||
| setupPreview, | ||
| } = require('internal/repl/utils'); | ||
| const { | ||
| getOwnNonIndexProperties, | ||
|
|
@@ -204,6 +205,9 @@ function REPLServer(prompt, | |
| } | ||
| } | ||
|
|
||
| const preview = options.terminal && | ||
ZYSzys marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| (options.preview !== undefined ? !!options.preview : true); | ||
|
||
|
|
||
| this.inputStream = options.input; | ||
| this.outputStream = options.output; | ||
| this.useColors = !!options.useColors; | ||
|
|
@@ -804,9 +808,20 @@ function REPLServer(prompt, | |
| } | ||
| }); | ||
|
|
||
| const { | ||
| clearPreview, | ||
| showInputPreview | ||
| } = setupPreview( | ||
| this, | ||
| kContextId, | ||
| kBufferedCommandSymbol, | ||
| preview | ||
| ); | ||
|
|
||
| // Wrap readline tty to enable editor mode and pausing. | ||
| const ttyWrite = self._ttyWrite.bind(self); | ||
| self._ttyWrite = (d, key) => { | ||
| clearPreview(); | ||
| key = key || {}; | ||
| if (paused && !(self.breakEvalOnSigint && key.ctrl && key.name === 'c')) { | ||
| pausedBuffer.push(['key', [d, key]]); | ||
|
|
@@ -819,6 +834,7 @@ function REPLServer(prompt, | |
| self.clearLine(); | ||
| } | ||
| ttyWrite(d, key); | ||
| showInputPreview(); | ||
| return; | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.