Repository navigation
perf: skip Markdown fence scans when no toggle opens - #26324
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe encoder now uses a matcher that computes Markdown fence ranges lazily and reuses them while scanning a document. Added tests cover scan reuse, non-matching content, nested and mixed-case toggles, codec reuse across documents, and fenced code around editable and non-editable details blocks. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The Markdown toggle optimization has no identified issue requiring a fix before merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ELI5
Saving ordinary Markdown still scans the whole document for code fences even when there is no toggle opening tag to examine. This skips that scan while preserving the saved text.
What Changed
Create one lazy matcher per encoding call. It uses the existing shared fence scanner only after a complete opening tag matches, then reuses those ranges for sibling toggles. The current parser, editor transport and save timing stay intact.
Why
The shared scanner already handles the parsing rules. Keeping its result inside one encoding call avoids stale ranges after edits and removes work without adding a persistent cache.
Linked Issue
Maintainer performance audit; no separate issue.
Visual Proof
N/A — string-processing change with no visual or interaction change.
Testing
Six focused editor suites / 135 tests pass on macOS with the background launch policy. Renderer typecheck passes. The changed-code quality gate passes. Hosted checks will run on the refreshed branch.
A deterministic exercise compared 2,137 inputs under two encoder options: all 4,274 outputs exactly match current main. It covers nested and malformed toggles, code fences, comments, line endings and reference links. The scanner runs once for 50 siblings and zero times in four cases with no matched opening tag. Current-main parsing differences from the older branch remain preserved.
Review
Independent review checked the conflict resolution against current main and exercised the actual encoder and codec. The update preserves the shared scanner already on main and changes only lazy admission and its tests.
Agent skill upstream boundary
Notes
No IPC, path handling, keyboard shortcuts, execution-host decisions or wire formats change. Local, folder and SSH workspaces use the same encoder. Physical Windows and Linux runs were not performed locally.
Checklist