Skip to content

repl: Customizable subprompt for multiline input #59566

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pckrishnadas88
Copy link
Contributor

Description:
This PR adds the ability to customise the REPL subprompt for multiline input. Previously, the REPL always used the fixed | prompt for multiline statements. With this change, the subprompt can be customised. Once feature finalised doc can be updated.

Feature: Customisable subprompt for multiline input.
Fixes : #59401

// custom-repl-subprompt.js
'use strict';
const repl = require('repl').start({ prompt: '> ' });

// Default behavior
// > const foo = {
// | bar: 42,
// | baz: 100
// | }
// > foo
// { bar: 42, baz: 100 }

// Set a custom multiline prompt
repl.setMultilinePrompt('... ');

// Example with custom prompt
// > const obj = {
// ... x: 1,
// ... y: 2
// ... }
// > obj
// { x: 1, y: 2 }

// Set an emoji as multiline prompt (UTF-8)
repl.setMultilinePrompt('😎 ');

// Example with emoji prompt
// > const emojiObj = {
// 😎 mood: 'happy',
// 😎 energy: 'high'
// 😎 }
// > emojiObj
// { mood: 'happy', energy: 'high' }

Add option to customize the REPL subprompt for multiline input.
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. readline Issues and PRs related to the built-in readline module. repl Issues and PRs related to the REPL subsystem. labels Aug 21, 2025
Copy link

codecov bot commented Aug 21, 2025

Codecov Report

❌ Patch coverage is 86.66667% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.86%. Comparing base (b87312b) to head (3bbdf10).
⚠️ Report is 82 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/readline/interface.js 85.18% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #59566      +/-   ##
==========================================
- Coverage   89.87%   89.86%   -0.02%     
==========================================
  Files         656      667      +11     
  Lines      192947   195245    +2298     
  Branches    37840    38336     +496     
==========================================
+ Hits       173418   175463    +2045     
- Misses      12087    12224     +137     
- Partials     7442     7558     +116     
Files with missing lines Coverage Δ
lib/internal/repl.js 100.00% <100.00%> (ø)
lib/repl.js 94.25% <100.00%> (+<0.01%) ⬆️
lib/internal/readline/interface.js 96.98% <85.18%> (-0.16%) ⬇️

... and 101 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ci PRs that need a full CI run. readline Issues and PRs related to the built-in readline module. repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants