Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign uprepl: support previews by eager evaluating input #30811
Conversation
| [ 'var ll = await Promise.resolve(2);', 'undefined' ], | ||
| [ 'll', ['// 2\r', '2'] ], | ||
| [ 'foo(await koo())', | ||
| [ 'f', '// 5oo', '// [Function: foo](await koo())\r', '4' ] ], |
This comment has been minimized.
This comment has been minimized.
BridgeAR
Dec 5, 2019
Author
Member
For reviewers: this output looks strange but it's correct. As soon as f is entered, the preview is generated and printed. Right afterwards oo is entered and the preview for the next variable is printed.
This comment was marked as outdated.
This comment was marked as outdated.
|
Can we have this be configurable in the |
|
+1 to have this be configurable on the repl API. But I really like it being enabled by default for the default repl. |
|
I just updated the code and made it configurable. PTAL. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
| @@ -203,6 +204,9 @@ function REPLServer(prompt, | |||
| } | |||
| } | |||
|
|
|||
| const preview = options.terminal && | |||
| (options.preview !== undefined ? !!options.preview : true); | |||
This comment has been minimized.
This comment has been minimized.
mscdex
Dec 6, 2019
Contributor
Doesn't this still prevent previews from being enabled if terminal is false-y? Why not only take .terminal into account if options.preview === undefined?
This comment has been minimized.
This comment has been minimized.
BridgeAR
Dec 6, 2019
Author
Member
That is correct. I would have liked to do that but the current proposal does not support previews for non-terminals yet. That requires additional work and I would rather do that in a follow-up PR.
This comment was marked as outdated.
This comment was marked as outdated.
|
I just pushed some small fixes that improve the preview even further: it should now be able to print everything that has no side effects correctly and the preview is even going to stick around after a window resize. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
nodejs-github-bot
commented
Dec 7, 2019
•
This adds input previews by using the inspectors eager evaluation functionality. It is implemented as additional line that is not counted towards the actual input. In case no colors are supported, it will be visible as comment. Otherwise it's grey. It will be triggered on any line change. It is heavily tested against edge cases and adheres to "dumb" terminals (previews are deactived in that case). Fixes: #20977
|
Rebased due to conflicts. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
LGTM. Nice work. |
nodejs-github-bot
commented
Dec 9, 2019
•
|
CI: https://ci.nodejs.org/job/node-test-pull-request/27519/ |
This adds input previews by using the inspectors eager evaluation functionality. It is implemented as additional line that is not counted towards the actual input. In case no colors are supported, it will be visible as comment. Otherwise it's grey. It will be triggered on any line change. It is heavily tested against edge cases and adheres to "dumb" terminals (previews are deactived in that case). PR-URL: #30811 Fixes: #20977 Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
|
Landed in 6bdf8d1 |
This adds input previews by using the inspectors eager evaluation functionality. It is implemented as additional line that is not counted towards the actual input. In case no colors are supported, it will be visible as comment. Otherwise it's grey. It will be triggered on any line change. It is heavily tested against edge cases and adheres to "dumb" terminals (previews are deactived in that case). PR-URL: #30811 Fixes: #20977 Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
This is a security release. This release includes a single commit, an update to npm to 6.13.4. For more details about the vulnerability please consult the npm blog: https://blog.npmjs.org/post/189618601100/binary-planting-with-the-npm-cli Notable Changes: * deps: - update npm to 6.13.4 #30904 - update uvwasi (Anna Henningsen) #30745 - upgrade to libuv 1.34.0 (Colin Ihrig) #30783 * doc: - docs deprecate http finished (Robert Nagy) #28679 * events: - add captureRejection option (Matteo Collina) #27867 * http: - add captureRejection support (Matteo Collina) #27867 - llhttp opt-in insecure HTTP header parsing (Sam Roberts) #30567 * http2: - implement capture rection for 'request' and 'stream' events (Matteo Collina) #27867 * net: - implement capture rejections for 'connection' event (Matteo Collina) #27867 * repl: - support previews by eager evaluating input (Ruben Bridgewater) #30811 * stream: - add support for captureRejection option (Matteo Collina) #27867 * tls: - implement capture rejections for 'secureConnection' event (Matteo Collina) #27867 - expose IETF name for current cipher suite (Sam Roberts) #30637 * worker: - add argv constructor option (legendecas) #30559 PR-URL: #30937
This is a security release. This release includes a single commit, an update to npm to 6.13.4. For more details about the vulnerability please consult the npm blog: https://blog.npmjs.org/post/189618601100/binary-planting-with-the-npm-cli Notable Changes: * deps: * update npm to 6.13.4 #30904 * update uvwasi (Anna Henningsen) #30745 * upgrade to libuv 1.34.0 (Colin Ihrig) #30783 * doc: * docs deprecate http finished (Robert Nagy) #28679 * events: * add captureRejection option (Matteo Collina) #27867 * http: * add captureRejection support (Matteo Collina) #27867 * llhttp opt-in insecure HTTP header parsing (Sam Roberts) #30567 * http2: * implement capture rection for 'request' and 'stream' events (Matteo Collina) #27867 * net: * implement capture rejections for 'connection' event (Matteo Collina) #27867 * repl: * support previews by eager evaluating input (Ruben Bridgewater) #30811 * stream: * add support for captureRejection option (Matteo Collina) #27867 * tls: * implement capture rejections for 'secureConnection' event (Matteo Collina) #27867 * expose IETF name for current cipher suite (Sam Roberts) #30637 * worker: * add argv constructor option (legendecas) #30559 PR-URL: #30937
This is a security release. For more details about the vulnerability please consult the npm blog: https://blog.npmjs.org/post/189618601100/binary-planting-with-the-npm-cli Notable Changes: * deps: * update npm to 6.13.4 #30904 * update uvwasi (Anna Henningsen) #30745 * upgrade to libuv 1.34.0 (Colin Ihrig) #30783 * doc: * docs deprecate http finished (Robert Nagy) #28679 * events: * add captureRejection option (Matteo Collina) #27867 * http: * add captureRejection support (Matteo Collina) #27867 * llhttp opt-in insecure HTTP header parsing (Sam Roberts) #30567 * http2: * implement capture rection for 'request' and 'stream' events (Matteo Collina) #27867 * net: * implement capture rejections for 'connection' event (Matteo Collina) #27867 * repl: * support previews by eager evaluating input (Ruben Bridgewater) #30811 * stream: * add support for captureRejection option (Matteo Collina) #27867 * tls: * implement capture rejections for 'secureConnection' event (Matteo Collina) #27867 * expose IETF name for current cipher suite (Sam Roberts) #30637 * worker: * add argv constructor option (legendecas) #30559 PR-URL: #30937
This is a security release. For more details about the vulnerability please consult the npm blog: https://blog.npmjs.org/post/189618601100/binary-planting-with-the-npm-cli Notable Changes: * deps: * update npm to 6.13.4 #30904 * update uvwasi (Anna Henningsen) #30745 * upgrade to libuv 1.34.0 (Colin Ihrig) #30783 * doc: * docs deprecate http finished (Robert Nagy) #28679 * events: * add captureRejection option (Matteo Collina) #27867 * http: * add captureRejection support (Matteo Collina) #27867 * llhttp opt-in insecure HTTP header parsing (Sam Roberts) #30567 * http2: * implement capture rection for 'request' and 'stream' events (Matteo Collina) #27867 * net: * implement capture rejections for 'connection' event (Matteo Collina) #27867 * repl: * support previews by eager evaluating input (Ruben Bridgewater) #30811 * stream: * add support for captureRejection option (Matteo Collina) #27867 * tls: * implement capture rejections for 'secureConnection' event (Matteo Collina) #27867 * expose IETF name for current cipher suite (Sam Roberts) #30637 * worker: * add argv constructor option (legendecas) #30559 PR-URL: #30937
This adds input previews by using the inspectors eager evaluation functionality. It is implemented as additional line that is not counted towards the actual input. In case no colors are supported, it will be visible as comment. Otherwise it's grey. It will be triggered on any line change. It is heavily tested against edge cases and adheres to "dumb" terminals (previews are deactived in that case). PR-URL: nodejs#30811 Fixes: nodejs#20977 Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
This is a security release. For more details about the vulnerability please consult the npm blog: https://blog.npmjs.org/post/189618601100/binary-planting-with-the-npm-cli Notable Changes: * deps: * update npm to 6.13.4 nodejs#30904 * update uvwasi (Anna Henningsen) nodejs#30745 * upgrade to libuv 1.34.0 (Colin Ihrig) nodejs#30783 * doc: * docs deprecate http finished (Robert Nagy) nodejs#28679 * events: * add captureRejection option (Matteo Collina) nodejs#27867 * http: * add captureRejection support (Matteo Collina) nodejs#27867 * llhttp opt-in insecure HTTP header parsing (Sam Roberts) nodejs#30567 * http2: * implement capture rection for 'request' and 'stream' events (Matteo Collina) nodejs#27867 * net: * implement capture rejections for 'connection' event (Matteo Collina) nodejs#27867 * repl: * support previews by eager evaluating input (Ruben Bridgewater) nodejs#30811 * stream: * add support for captureRejection option (Matteo Collina) nodejs#27867 * tls: * implement capture rejections for 'secureConnection' event (Matteo Collina) nodejs#27867 * expose IETF name for current cipher suite (Sam Roberts) nodejs#30637 * worker: * add argv constructor option (legendecas) nodejs#30559 PR-URL: nodejs#30937
This adds input previews by using the inspectors eager evaluation functionality. It is implemented as additional line that is not counted towards the actual input. In case no colors are supported, it will be visible as comment. Otherwise it's grey. It will be triggered on any line change. It is heavily tested against edge cases and adheres to "dumb" terminals (previews are deactived in that case). PR-URL: nodejs#30811 Fixes: nodejs#20977 Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
This adds input previews by using the inspectors eager evaluation functionality. It is implemented as additional line that is not counted towards the actual input. In case no colors are supported, it will be visible as comment. Otherwise it's grey. It will be triggered on any line change. It is heavily tested against edge cases and adheres to "dumb" terminals (previews are deactived in that case). PR-URL: #30811 Fixes: #20977 Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
Notable changes: * [33c226a] - (SEMVER-MINOR) n-api: detect deadlocks in thread-safe function (Gabriel Schulhof) #32860 * [aed5112] - doc: add juanarbol as collaborator (Juan José Arboleda) #32906 * [47d2a96] - doc: add puzpuzpuz to collaborators (Andrey Pechkurov) #32817 * [6aa3869] - (SEMVER-MINOR) util: add `maxStrLength` option to `inspect` function (unknown) #32392 * [ca4e652] - (SEMVER-MINOR) worker: support MessagePort to workers data (Juan José Arboleda) #32278 * [a100709] - (SEMVER-MINOR) fs: make parameters optional for readSync (Lucas Holmquist) #32460 * [b7d264e] - (SEMVER-MINOR) dns: add dns.ALL hints flag constant (murgatroid99) #32183 * [6601fac] - (SEMVER-MINOR) fs: add fs.readv() (Sk Sajidul Kadir) #32356 * [e67b97e] - (SEMVER-MINOR) cli: allow --huge-max-old-generation-size in NODE_OPTIONS (Anna Henningsen) #32251 * [b598321] - (SEMVER-MINOR) lib: add option to disable __proto__ (Gus Caplan) #32279 * [4ec25b4] - (SEMVER-MINOR) src,cli: support compact (one-line) JSON reports (Sam Roberts) #32254 * [fd2486e] - (SEMVER-MINOR) doc: update stability of report features (Colin Ihrig) #32242 * [90d35ad] - (SEMVER-MINOR) doc,lib,src,test: make --experimental-report a nop (Colin Ihrig) #32242 * [6a0bc83] - (SEMVER-MINOR) test: remove common.skipIfReportDisabled() (Colin Ihrig) #32242 * [984ae30] - (SEMVER-MINOR) build: make --without-report a no-op (Colin Ihrig) #32242 * [70eaba1] - (SEMVER-MINOR) build: remove node_report option in node.gyp (Colin Ihrig) #32242 * [0b310df] - (SEMVER-MINOR) src: unconditionally include report feature (Colin Ihrig) #32242 * [ae83f0f] - (SEMVER-MINOR) deps: upgrade to libuv 1.35.0 (Colin Ihrig) #32204 * [217e3df] - (SEMVER-MINOR) worker: allow URL in Worker constructor (Antoine du HAMEL) #31664 * [16a913f] - (SEMVER-MINOR) fs: make fs.read params optional (Lucas Holmquist) #31402 * [394487e] - (SEMVER-MINOR) src: create a getter for kernel version (Juan José Arboleda) #31732 * [5c81b8d] - (SEMVER-MINOR) wasi: add returnOnExit option (Colin Ihrig) #32101 * [6348fae] - (SEMVER-MINOR) tls: expose SSL_export_keying_material (simon) #31814 * [9eeee0d] - (SEMVER-MINOR) perf_hooks: add property flags to GCPerformanceEntry (Kirill Fomichev) #29547 * [ab8f38b] - (SEMVER-MINOR) worker: add ability to take heap snapshot from parent thread (Anna Henningsen) #31569 * [a35e88c] - (SEMVER-MINOR) async_hooks: merge run and exit methods (Andrey Pechkurov) #31950 * [3eb3406] - (SEMVER-MINOR) async_hooks: prevent sync methods of async storage exiting outer context (Stephen Belanger) #31950 * [22db34c] - (SEMVER-MINOR) async_hooks: add sync enterWith to ALS (Stephen Belanger) #31945 * [16e8b11] - (SEMVER-MINOR) async_hooks: introduce async-context API (Vladimir de Turckheim) #26540 * [f7adfcc] - (SEMVER-MINOR) async_hooks: add executionAsyncResource (Matteo Collina) #30959 * [8c497f8] - (SEMVER-MINOR) events: allow monitoring error events (Gerhard Stoebich) #30932 * [7260ede] - (SEMVER-MINOR) fs: return first folder made by mkdir recursive (Benjamin Coe) #31530 * [5ec9295] - (SEMVER-MINOR) process: report ArrayBuffer memory in `memoryUsage()` (Anna Henningsen) #31550 * [b038ad9] - (SEMVER-MINOR) src,lib: make ^C print a JS stack trace (legendecas) #29207 * [e22d853] - (SEMVER-MINOR) n-api: define release 6 (Gabriel Schulhof) #32058 * [f56c4dd] - (SEMVER-MINOR) n-api: add napi_get_all_property_names (himself65) #30006 * [733002b] - (SEMVER-MINOR) test: skip keygen tests on arm systems (Tobias Nießen) #31178 * [40253cc] - (SEMVER-MINOR) crypto: add crypto.diffieHellman (Tobias Nießen) #31178 * [1977136] - (SEMVER-MINOR) crypto: add DH support to generateKeyPair (Tobias Nießen) #31178 * [5dab489] - (SEMVER-MINOR) crypto: simplify DH groups (Tobias Nießen) #31178 * [9f85585] - (SEMVER-MINOR) crypto: add key type 'dh' (Tobias Nießen) #31178 * [784fb8f] - (SEMVER-MINOR) module: add API for interacting with source maps (Benjamin Coe) #31132 * [eda6665] - (SEMVER-MINOR) vm: add code cache support for SourceTextModule (Gus Caplan) #31278 * [de3603f] - (SEMVER-MINOR) process: allow monitoring uncaughtException (Gerhard Stoebich) #31257 * [a15e712] - (SEMVER-MINOR) fs: allow overriding fs for streams (Robert Nagy) #29083 * [a0b1a06] - (SEMVER-MINOR) util: add todo comments for inspect to add unicode support (Ruben Bridgewater) #31112 * [5e5d053] - (SEMVER-MINOR) test: add repl tests to verify unicode support in previews (Ruben Bridgewater) #31112 * [a4ca378] - (SEMVER-MINOR) repl: activate previews for lines exceeding the terminal columns (Ruben Bridgewater) #31112 * [4e9e440] - (SEMVER-MINOR) readline,repl: support tabs properly (Ruben Bridgewater) #31112 * [f3fb6a1] - (SEMVER-MINOR) src: change GetStringWidth's expand_emoji_sequence option default (Ruben Bridgewater) #31112 * [4f6300f] - (SEMVER-MINOR) src: improve GetColumnWidth performance (Ruben Bridgewater) #31112 * [5231c84] - (SEMVER-MINOR) readline: move charLengthLeft() and charLengthAt() (Ruben Bridgewater) #31112 * [03efa71] - (SEMVER-MINOR) readline: improve getStringWidth() (Ruben Bridgewater) #31112 * [cf28afe] - (SEMVER-MINOR) readline,repl: improve history up/previous (Ruben Bridgewater) #31112 * [a0eb3e4] - (SEMVER-MINOR) readline,repl: skip history entries identical to the current line (Ruben Bridgewater) #31112 * [d7e153b] - (SEMVER-MINOR) readline,repl: add substring based history search (Ruben Bridgewater) #31112 * [a892b4d] - (SEMVER-MINOR) repl: improve preview length calculation (Ruben Bridgewater) #31112 * [e894eeb] - (SEMVER-MINOR) readline: set null as callback return in case there's no error (Ruben Bridgewater) #31006 * [3946cad] - (SEMVER-MINOR) readline: small refactoring (Ruben Bridgewater) #31006 * [936c85c] - (SEMVER-MINOR) repl: implement reverse search (Ruben Bridgewater) #31006 * [85f8654] - (SEMVER-MINOR) repl: fix preview of lines that exceed the terminal columns (Ruben Bridgewater) #31006 * [f1624bb] - (SEMVER-MINOR) test: add multiple repl preview tests (Ruben Bridgewater) #30907 * [47dfa22] - (SEMVER-MINOR) repl: fix preview bug in case of long lines (Ruben Bridgewater) #30907 * [bf9ff16] - (SEMVER-MINOR) repl: add completion preview (Ruben Bridgewater) #30907 * [7131de5] - (SEMVER-MINOR) repl: improve completion (Ruben Bridgewater) #30907 * [8be0031] - (SEMVER-MINOR) repl,readline: refactor for simplicity (Ruben Bridgewater) #30907 * [6eda28c] - (SEMVER-MINOR) repl,readline: refactor common code (Ruben Bridgewater) #30907 * [0bafe08] - (SEMVER-MINOR) readline: update ansi-regex (Ruben Bridgewater) #30907 * [6188650] - (SEMVER-MINOR) repl: simplify code (Ruben Bridgewater) #30907 * [9b893e1] - (SEMVER-MINOR) repl: simplify repl autocompletion (Ruben Bridgewater) #30907 * [78dcdee] - (SEMVER-MINOR) repl: remove dead code (Ruben Bridgewater) #30907 * [b14440f] - (SEMVER-MINOR) repl: support previews by eager evaluating input (Ruben Bridgewater) #30811 * [d609881] - http,https: increase server headers timeout (Tim Costa) #30071 PR-URL: TODO
BridgeAR commentedDec 5, 2019
This adds input previews by using the inspectors eager evaluation
functionality.
It is implemented as additional line that is not counted towards
the actual input. In case no colors are supported, it will be visible
as comment. Otherwise it's grey.
It will be triggered on any line change. It is heavily tested against
edge cases and adheres to "dumb" terminals (previews are deactived
in that case).
Small videos that outline the behavior:
https://asciinema.org/a/YwJ92D8vrj7bD5XGNGZzFhxU8
https://asciinema.org/a/bgalyUuG49w96RSzwfhYzLpXL
This is an alternative to #22875.
Fixes: #20977
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes