GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||
GeezerVison is showing github.com — repl: support previews by eager evaluating input by BridgeAR · Pull Request #30811 · nodejs/node Conversation
Member
This adds input previews by using the inspectors eager evaluation Small videos that outline the behavior: https://asciinema.org/a/YwJ92D8vrj7bD5XGNGZzFhxU8 This is an alternative to #22875. Fixes: #20977 Checklist
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
BridgeAR
commented
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For reviewers: this output looks strange but it's correct. As soon as
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
This comment has been minimized.
BridgeAR
force-pushed
the
implement-repl-previews
branch
from
9fc4363 to
54a9b87
Compare
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Member
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
BridgeAR
force-pushed
the
implement-repl-previews
branch
from
580ed6e to
87b35e4
Compare
This comment has been minimized.
mscdex
reviewed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't this still prevent previews from being enabled if
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
antsmartian
reviewed
Uh oh!
There was an error while loading. Please reload this page.
Contributor
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
antsmartian
reviewed
Uh oh!
There was an error while loading. Please reload this page.
antsmartian
reviewed
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
Member
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
There was an error while loading. Please reload this page.
|
CI: https://ci.nodejs.org/job/node-test-pull-request/27429/ ✔️ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
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: nodejs#20977
2d80fc5 to
8bba55a
Compare
|
Rebased due to conflicts. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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 <[email protected]> Reviewed-By: Anto Aravinth <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
|
Landed in 6bdf8d1 🎉 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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 <[email protected]> Reviewed-By: Anto Aravinth <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
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 <[email protected]> Reviewed-By: Anto Aravinth <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
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 <[email protected]> Reviewed-By: Anto Aravinth <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
|
So ehm... how can I turn it off ? When I'm typing a command in a repl I want to focus on what I'm typing and I find it very distracting to have text dancing around my input line. I've also had cases where it was eagerly evaluating fairly expensive computations and the repl started lagging, and I've had a case where I was editing a line that invoked a v8 native (which are rather intolerant to bad inputs) and eager evaluation resulted in a v8 crash. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@mvduin it is possible to pass through any options that you like when starting the REPL directly. It's possible to deactivate the preview mode by passing through Do you still remember the command that caused the crash? Any method that might cause a side effect is normally not triggered. If it is marked as side effect free while it's not, than that's a bug and we should fix it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
That invocation worked but lacks persistent history. I tried It would be nice if there were a simple way to set default options for the repl instance created when you invoke nodejs interactively, via a config file or environment variable. I did just come up with a gross but functional workaround: I set 'use strict'; const repl = require('repl'); const orig_start = repl.start; repl.start = options => orig_start({ ...options, preview: false, }); And the problem wasn't side-effects, it's that all v8 natives use asserts rather than exceptions for type-checking their arguments. An example expression that crashes if typed with preview enabled is I also just realized another danger of preview: all of its evaluations still contribute to the optimizer statistics and it's not hard to imagine accidently calling things with abnormal types while editing a line and making a mess. This could be especially bad if you're trying to do benchmarks or analyze performance problems. However, while trying to make an example to demonstrate that, I found a significantly more serious problem: start const foo = (x) => [ x, x, x, x ]; for( let i = 0; i < 100; i++ ) foo(42); %OptimizeFunctionOnNextCall(foo) let x = foo(42) // x = prevents preview x = foo(42) // x = prevents preview assert.equal( %GetOptimizationStatus(foo), 0b110001 ); // TurboFan optimized Now type |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
It is a very useful tool to better understand v8 and optimization. The demonstration that preview of |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Implement "eager evaluation" in the REPL
There was an error while loading. Please reload this page.