GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — repl: improve repl preview by BridgeAR · Pull Request #33282 · nodejs/node

Conversation

@BridgeAR

@BridgeAR BridgeAR commented May 7, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Please check the commit messages for details.

Fixes: #33238

@nodejs/repl

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss and ExE-Boss reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@BridgeAR
BridgeAR requested review from jasnell and targos May 7, 2020 16:28
@nodejs-github-bot nodejs-github-bot added the repl Issues and PRs related to the REPL subsystem. label May 7, 2020
BridgeAR added 2 commits May 7, 2020 18:44
@BridgeAR
repl: improve repl preview
210aee2
This aligns the REPL preview with the one used in the Chrome
DevTools console. It will now preview the output for the input
including the completion suffix as input. When pressing enter while
previewing such data, it will automatically insert the suffix
before evaluating the input. When pressing escape, that behavior
is deactivated until the input is changed.

Signed-off-by: Ruben Bridgewater <[email protected]>
@BridgeAR
repl: show reference errors during preview
733baf1
This aligns the behavior with the one in the Firefox console.
It will visualize ReferenceErrors in case the input has no possible
completion and no buffered input. That way typos can already be
highlighted before being evaluated.

Signed-off-by: Ruben Bridgewater <[email protected]>
@BridgeAR
BridgeAR force-pushed the improve-repl-preview branch from e8bcc7c to 7821dd2 Compare May 7, 2020 16:44
@nodejs-github-bot

This comment has been minimized.

Sign in to view
@BridgeAR
repl: replace hard coded core module list with actual list
a62e2b2
This replaces the internally used hard coded Node.js core module
list with the actual internal existent modules. That way all modules
are automatically picked up instead of having to update the list
manually.

This currently only applies to the REPL and to the Node.js `eval`
functionality (User passed `-e` or `--eval` arguments to Node without
`-i` or `--interactive`).

Signed-off-by: Ruben Bridgewater <[email protected]>
@BridgeAR
BridgeAR force-pushed the improve-repl-preview branch from 585ca68 to c410d68 Compare May 7, 2020 19:01
@nodejs-github-bot

This comment has been minimized.

Sign in to view
BridgeAR added 2 commits May 8, 2020 01:35
@BridgeAR
test: refactor test/parallel/test-bootstrap-modules.js
c24445d
This simplifies the test a bit by removing duplicated code and by
focusing the reader on the passed through module.

Signed-off-by: Ruben Bridgewater <[email protected]>
@BridgeAR
repl: improve repl autocompletion for require calls
00cd4d8
This improves the autocompletion for require calls. It had multiple
small issues so far. Most important: it won't suggest completions for
require statements that are fully written out. Second, it'll detect
require calls that have whitespace behind the opening bracket. Third,
it makes sure node modules are detected as such instead of only
suggesting them as folders. Last, it adds suggestions for input that
starts with backticks.

Fixes: nodejs#33238

Signed-off-by: Ruben Bridgewater <[email protected]>
@BridgeAR
BridgeAR force-pushed the improve-repl-preview branch from c410d68 to 00cd4d8 Compare May 7, 2020 23:35
@nodejs-github-bot

This comment has been minimized.

Sign in to view
This was referenced May 8, 2020
repl: deprecate duplicated repl features #33294
Closed
repl: add builtinModules #33295
Closed
@nodejs-github-bot

This comment has been minimized.

Sign in to view
@nodejs-github-bot

This comment has been minimized.

Sign in to view
@BridgeAR

BridgeAR commented May 9, 2020

Copy link
Copy Markdown
Member Author

@nodejs/repl PTAL. This could use some reviews.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@BridgeAR BridgeAR added the semver-minor PRs that contain new features and should be released in the next minor version. label May 10, 2020
@targos

targos commented May 10, 2020

Copy link
Copy Markdown
Member

I really like the behavior with the first commit!

I do not understand how the second one works, though (repl: show reference errors during preview). I tried to start node with --use-strict, which throws ReferenceError for bad assignments but the behavior of the REPL doesn't change.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@BridgeAR

BridgeAR commented May 11, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

@targos thanks, I did not include a check to detect --use-strict. That is actually a V8 feature and not from Node.js. As such we lack any documentation of it and we implemented a own way to use the strict mode with the REPL: NODE_REPL_MODE = 'strict'.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@BridgeAR
fixup! repl: show reference errors during preview
abc2bda
This adds support for `--use-strict`.

Signed-off-by: Ruben Bridgewater <[email protected]>
@BridgeAR

BridgeAR commented May 11, 2020

Copy link
Copy Markdown
Member Author

I added support for --use-strict as well, since it does seem to be useful for the REPL.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@BridgeAR
BridgeAR force-pushed the improve-repl-preview branch from 88c5344 to abc2bda Compare May 11, 2020 12:23
@nodejs-github-bot

nodejs-github-bot commented May 11, 2020

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/31275/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jasnell
jasnell approved these changes May 11, 2020
View reviewed changes
@BridgeAR BridgeAR added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label May 11, 2020
targos
targos approved these changes May 12, 2020
View reviewed changes
@nodejs-github-bot

nodejs-github-bot commented May 12, 2020

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/31292/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

codebytere added a commit that referenced this pull request May 19, 2020
@codebytere
2020-05-19, Version 14.3.0 (Current)
5d81e4d
Notable changes:

async_hooks:
  * (SEMVER-MINOR) move PromiseHook handler to JS (Stephen Belanger) #32891
cli:
  * (SEMVER-MINOR) add `--trace-atomics-wait` flag (Anna Henningsen) #33292
fs:
  * (SEMVER-MINOR) add .ref() and .unref() methods to watcher classes (rickyes) #33134
http:
  * (SEMVER-MINOR) expose http.validate-header-name/value (osher) #33119
repl:
  * (SEMVER-MINOR) deprecate repl._builtinLibs (Ruben Bridgewater) #33294
  * (SEMVER-MINOR) deprecate repl.inputStream and repl.outputStream (Ruben Bridgewater) #33294
  * (SEMVER-MINOR) show reference errors during preview (Ruben Bridgewater) #33282
  * (SEMVER-MINOR) improve repl preview (Ruben Bridgewater) #33282
src:
  * add support for TLA (Gus Caplan) #30370

PR-URL: TODO
codebytere added a commit that referenced this pull request May 19, 2020
@codebytere
2020-05-19, Version 14.3.0 (Current)
c841f51
Notable changes:

async_hooks:
  * (SEMVER-MINOR) move PromiseHook handler to JS (Stephen Belanger) #32891
cli:
  * (SEMVER-MINOR) add `--trace-atomics-wait` flag (Anna Henningsen) #33292
fs:
  * (SEMVER-MINOR) add .ref() and .unref() methods to watcher classes (rickyes) #33134
http:
  * (SEMVER-MINOR) expose http.validate-header-name/value (osher) #33119
repl:
  * (SEMVER-MINOR) deprecate repl._builtinLibs (Ruben Bridgewater) #33294
  * (SEMVER-MINOR) deprecate repl.inputStream and repl.outputStream (Ruben Bridgewater) #33294
  * (SEMVER-MINOR) show reference errors during preview (Ruben Bridgewater) #33282
  * (SEMVER-MINOR) improve repl preview (Ruben Bridgewater) #33282
src:
  * add support for TLA (Gus Caplan) #30370

PR-URL: #33452
@MylesBorins

MylesBorins commented Aug 17, 2020

Copy link
Copy Markdown
Contributor

Is this something we want to backport to v12.x? Based on the various commits referencing this PR I'm imagining it might need to be a couple different PRs all at once.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@MylesBorins MylesBorins added the backport-requested-v12.x label Aug 17, 2020
@addaleax addaleax added dont-land-on-v12.x and removed backport-requested-v12.x labels Sep 23, 2020
@addaleax

addaleax commented Nov 25, 2020

Copy link
Copy Markdown
Member

@BridgeAR @jasnell @targos This uses blocking operations for autocompletion. Can we revert this, or fix that? It’s extremely annoying that the repl hangs for an indefinite amount of time when you type require(' when your node_modules directory is large. It also doesn’t seem necessary, given that the autocomplete API is designed to be asynchronous.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

addaleax added a commit to addaleax/node that referenced this pull request Dec 18, 2020
@addaleax
repl: disable blocking completions by default
200ae1d
It’s not okay for the REPL to be blocked for multiple seconds after
entering `require('` because the completion is performing blocking
fs operations on potentially huge directories. Turning the REPL
completion function asynchronous would be the right thing to do here,
but unfortunately the way the code is structured doesn’t play well
with that (in particular, it breaks the preview feature).
Therefore, disable these blocking calls by default.

Refs: nodejs#33282 (comment)
@addaleax addaleax mentioned this pull request Dec 18, 2020
repl: disable blocking completions by default #36564
Closed
2 tasks done
@addaleax

addaleax commented Dec 18, 2020

Copy link
Copy Markdown
Member

Since there’s been no reply, I’ve opened #36564 to disable this by default.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

addaleax added a commit that referenced this pull request Dec 21, 2020
@addaleax
repl: disable blocking completions by default
82dd23f
It’s not okay for the REPL to be blocked for multiple seconds after
entering `require('` because the completion is performing blocking
fs operations on potentially huge directories. Turning the REPL
completion function asynchronous would be the right thing to do here,
but unfortunately the way the code is structured doesn’t play well
with that (in particular, it breaks the preview feature).
Therefore, disable these blocking calls by default.

Refs: #33282 (comment)

PR-URL: #36564
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
targos pushed a commit that referenced this pull request Dec 21, 2020
@addaleax @targos
repl: disable blocking completions by default
7c903ec
It’s not okay for the REPL to be blocked for multiple seconds after
entering `require('` because the completion is performing blocking
fs operations on potentially huge directories. Turning the REPL
completion function asynchronous would be the right thing to do here,
but unfortunately the way the code is structured doesn’t play well
with that (in particular, it breaks the preview feature).
Therefore, disable these blocking calls by default.

Refs: #33282 (comment)

PR-URL: #36564
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
@ExE-Boss ExE-Boss mentioned this pull request Feb 2, 2021
repl: add auto‑completion for dynamic import calls #37178
Merged
1 task done
Trott pushed a commit to ExE-Boss/node that referenced this pull request Feb 6, 2021
@ExE-Boss @Trott
repl: add auto‑completion for dynamic import calls
3aba6fe
Refs: nodejs#33238
Refs: nodejs#33282

Co-authored-by: Antoine du Hamel <[email protected]>

PR-URL: nodejs#37178
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
danielleadams pushed a commit that referenced this pull request Feb 16, 2021
@ExE-Boss @danielleadams
repl: add auto‑completion for dynamic import calls
3fee5b2
Refs: #33238
Refs: #33282

Co-authored-by: Antoine du Hamel <[email protected]>

PR-URL: #37178
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
danielleadams pushed a commit that referenced this pull request Apr 29, 2021
@addaleax @danielleadams
repl: disable blocking completions by default
1ac07b2
It’s not okay for the REPL to be blocked for multiple seconds after
entering `require('` because the completion is performing blocking
fs operations on potentially huge directories. Turning the REPL
completion function asynchronous would be the right thing to do here,
but unfortunately the way the code is structured doesn’t play well
with that (in particular, it breaks the preview feature).
Therefore, disable these blocking calls by default.

Refs: #33282 (comment)

PR-URL: #36564
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
targos pushed a commit to targos/node that referenced this pull request Aug 8, 2021
@ExE-Boss @targos
repl: add auto‑completion for dynamic import calls
14dcf7c
Refs: nodejs#33238
Refs: nodejs#33282

Co-authored-by: Antoine du Hamel <[email protected]>

PR-URL: nodejs#37178
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
targos pushed a commit that referenced this pull request Sep 1, 2021
@ExE-Boss @targos
repl: add auto‑completion for dynamic import calls
88b02cb
Refs: #33238
Refs: #33282

Co-authored-by: Antoine du Hamel <[email protected]>

PR-URL: #37178
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jasnell jasnell jasnell approved these changes
+1 more reviewer
@targos targos targos approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. repl Issues and PRs related to the REPL subsystem. semver-minor PRs that contain new features and should be released in the next minor version.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

repl: Extra / on completion after require

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@BridgeAR @nodejs-github-bot @targos @MylesBorins @addaleax @jasnell
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.