Skip to content
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

repl: change preview default in case of custom eval functions #31259

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions doc/api/repl.md
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,9 @@ changes:
`SIGINT` is received, such as when `Ctrl+C` is pressed. This cannot be used
together with a custom `eval` function. **Default:** `false`.
* `preview` {boolean} Defines if the repl prints autocomplete and output
previews or not. **Default:** `true`. If `terminal` is falsy, then there are
no previews and the value of `preview` has no effect.
previews or not. **Default:** `true` with the default eval function and
`false` in case a custom eval function is used. If `terminal` is falsy, then
there are no previews and the value of `preview` has no effect.
* Returns: {repl.REPLServer}

The `repl.start()` method creates and starts a [`repl.REPLServer`][] instance.
Expand Down
3 changes: 2 additions & 1 deletion lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,9 @@ function REPLServer(prompt,
}
}

// TODO(devsnek): Add a test case for custom eval functions.
const preview = options.terminal &&
(options.preview !== undefined ? !!options.preview : true);
(options.preview !== undefined ? !!options.preview : !eval_);

this.inputStream = options.input;
this.outputStream = options.output;
Expand Down