repl: add syntax highlighting, auto-indentation, and signature hints#64443
Open
hemanth wants to merge 1 commit into
Open
repl: add syntax highlighting, auto-indentation, and signature hints#64443hemanth wants to merge 1 commit into
hemanth wants to merge 1 commit into
Conversation
Collaborator
|
Review requested:
|
30413de to
14baff1
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #64443 +/- ##
==========================================
- Coverage 90.23% 90.20% -0.03%
==========================================
Files 741 741
Lines 241375 242099 +724
Branches 45483 45621 +138
==========================================
+ Hits 217800 218397 +597
- Misses 15129 15241 +112
- Partials 8446 8461 +15
🚀 New features to boost your workflow:
|
16ee02c to
b749718
Compare
avivkeller
requested changes
Jul 12, 2026
avivkeller
left a comment
Member
There was a problem hiding this comment.
can these be idiomatic PRs?
Contributor
Author
|
@avivkeller for sure! having some challenges on my local machine, so depending on the GH CI to report me the build time errors. |
b749718 to
1e7bcec
Compare
Add experimental REPL enhancements behind the --experimental-repl-enhancements flag: 1. Inline syntax highlighting using the Acorn tokenizer to colorize keywords (magenta), strings (green), numbers (yellow), booleans/null (yellow), regular expressions (red), and comments (gray). 2. Auto-indentation for multiline input based on brace/bracket/paren depth, using 2-space indentation. 3. Function signature hints that display parameter lists as dimmed text below the input when the user types a function call. All features are off by default and require the CLI flag to enable. Highlighting is applied at display time only so cursor positioning and evaluation are unaffected. Refs: nodejs#48164 Signed-off-by: hemanth <hemanth.hm@gmail.com>
1e7bcec to
088a905
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Add experimental REPL enhancements behind the
--experimental-repl-enhancementsCLI flag:1. Inline Syntax Highlighting
Uses the Acorn tokenizer (already in
deps/) to colorize JavaScript input in real-time:const,function,if, etc.) → MagentaHighlighting is applied at display time only —
repl.lineremains plain text, so cursor positioning and evaluation are unaffected.2. Auto-Indentation
Automatically inserts 2-space indentation on continuation lines based on brace/bracket/paren depth when entering multiline input.
3. Function Signature Hints
When the user types
functionName(, the function's parameter list is displayed as a dimmed hint below the input line. Uses the V8 Inspector protocol withthrowOnSideEffect: truefor safety.Usage
All features are off by default — nothing changes for users unless they explicitly pass the flag. Individual features can also be controlled via
repl.start()options (e.g.,syntaxHighlighting: false).Motivation
This addresses the feature requests from #48164, which was closed as not planned. However, by gating everything behind an experimental flag with no behavioral changes to the default REPL, the risk profile is minimal. These are quality-of-life improvements that bring the Node.js REPL closer to modern shell experiences (Python's IPython, Ruby's Pry, etc.).
Refs: #48164