← Back to Pull requests

perf: highlight with fewer grammars by default #1235

Open
unknown opened this pull request with 221 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 03, 2026 19:33 UTC
Author

<!--
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. langAlias takes 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

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.

  • I have run node --run test and all tests passed.

  • I have check code formatting with node --run format:check & node --run lint.

  • I've covered new added functionality with unit tests if necessary.
  • Diff: 221 lines (+165 / -56) across 2 files Reviewer: avivkeller Review duration: 33091m
    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
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 36.8% (MEDIUM) · Higher = larger blast radius
    36.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.6% · Safe to merge
    19.6%
    Repository