Skip to content

repl: add basic syntax highlighting#64591

Open
avivkeller wants to merge 2 commits into
nodejs:mainfrom
avivkeller:repl-syntax-highlighting
Open

repl: add basic syntax highlighting#64591
avivkeller wants to merge 2 commits into
nodejs:mainfrom
avivkeller:repl-syntax-highlighting

Conversation

@avivkeller

@avivkeller avivkeller commented Jul 19, 2026

Copy link
Copy Markdown
Member

Adds basic syntax highlighting similar to our util.inspect. Highlighting is done using util.inspect.styles, so the coloring is in-tune with inspect, see below:

Screenshot 2026-07-18 at 7 37 24 PM

Notable Change: The REPL now performs syntax highlighting when useColors: true

@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 Jul 19, 2026
Signed-off-by: avivkeller <me@aviv.sh>
@avivkeller
avivkeller force-pushed the repl-syntax-highlighting branch from 840d437 to 1eb1502 Compare July 19, 2026 02:44
@avivkeller

Copy link
Copy Markdown
Member Author

cc @nodejs/repl

@avivkeller avivkeller added the notable-change PRs with changes that should be highlighted in changelogs. label Jul 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The notable-change PRs with changes that should be highlighted in changelogs. label has been added by @avivkeller.

Please suggest a text for the release notes if you'd like to include a more detailed summary, then proceed to update the PR description with the text or a link to the notable change suggested text comment. Otherwise, the commit will be placed in the Other Notable Changes section.

@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.13084% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.14%. Comparing base (4f844f4) to head (afd0c77).

Files with missing lines Patch % Lines
lib/internal/repl/highlight.js 97.75% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #64591    +/-   ##
========================================
  Coverage   90.13%   90.14%            
========================================
  Files         741      742     +1     
  Lines      241976   242078   +102     
  Branches    45543    45578    +35     
========================================
+ Hits       218116   218232   +116     
+ Misses      15379    15370     -9     
+ Partials     8481     8476     -5     
Files with missing lines Coverage Δ
lib/internal/readline/interface.js 93.25% <100.00%> (+0.04%) ⬆️
lib/internal/util/inspect.js 96.93% <100.00%> (+<0.01%) ⬆️
lib/repl.js 92.93% <100.00%> (+0.01%) ⬆️
lib/internal/repl/highlight.js 97.75% <97.75%> (ø)

... and 34 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. notable-change PRs with changes that should be highlighted in changelogs. 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