perf: highlight with fewer grammars by default #1235
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.37) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 221 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.323
Real PR Conversation Timeline
1 comments
"Review active on #1235"
general
weight: 0.35
avivkeller
<!--
Please read the Code of Conduct and the Contributing Guidelines before opening a pull request.
-->
Description
This PR highlights code with fewer grammars by default, as each one takes its own memory on every thread. JavaScript (
js,mjs,cjs,javascript) now uses TypeScript's grammar, and C++ (cpp,c++) uses C's. In the light theme JavaScript looks the same, and Nord loses a few colors only JavaScript's grammar gives.langAliastakes precedence, so{ cpp: 'cpp' }brings C++'s own grammar back.doc-kit now resolves aliases itself, since Shiki replaced configured ones with a grammar's own as it registered it, so aliases also follow other aliases and match in any case.
| Build | Threads | Time | Peak memory |
| --- | ---: | ---: | ---: |
| site | 4 | 9.25s → 8.99s (-3%) | 1797 → 1702MB (-5%) |
| site | 6 | 8.50s → 8.35s (-2%) | 2216 → 2009MB (-9%) |
| legacy | 4 | 4.24s → 4.00s (-6%) | 1539 → 1646MB (+7%) |
| legacy | 6 | 4.20s → 4.17s (-1%) | 1972 → 1873MB (-5%) |
Validation
Added tests for highlighting JavaScript as TypeScript and C++ as C, configured aliases taking precedence, following aliases in any case, and an alias leading to a language of
langs.Related Issues
Split out of #1205.
Check List
node --run testand all tests passed.node --run format:check&node --run lint.