Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The footnote label matching regexes are inconsistent/unclear in a way that can cause edge-case mismatches between footnote definition handling and reference recognition.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds support for “syntax hidden” footnotes by detecting footnote references/definitions in the CodeMirror syntax tree, rendering them with hidden markers + icons, and enabling navigation between references and definitions (with optional system beep feedback).
Changes:
- Add footnote reference/definition detection and corresponding decorations/widgets (including a back icon for definitions).
- Add navigation helper to jump between footnote references and definitions using a single syntax parse attempt.
- Add a safe
playSystemBeep()wrapper + localized strings, and expand hidden-syntax tests to cover footnote rendering and navigation.
File summaries
| File | Description |
|---|---|
| tests/hiddenSyntax/navigation.test.ts | Adds focused unit tests for followFootnote() navigation behavior and parse timeout handling. |
| tests/hiddenSyntax/link.test.ts | Extends hidden-syntax rendering tests to cover footnote references/definitions, navigation, and beep behavior. |
| src/shared/utils.ts | Introduces playSystemBeep() wrapper that safely calls the host API when available. |
| src/shared/strings.ts | Adds localized UI strings for footnote navigation tooltips. |
| src/hiddenSyntax/navigation.ts | Implements followFootnote() and refactors selection/scroll revealing into a shared helper. |
| src/hiddenSyntax/link.ts | Adds footnote parsing helpers for references and definition markers. |
| src/hiddenSyntax/index.ts | Integrates footnote decorations/widgets into the main hidden-syntax decoration pipeline. |
| src/hiddenSyntax/components/icon.ts | Adds footnote/footnote-back icon behaviors and localized tooltips; beeps on empty destinations. |
| src/hiddenSyntax/components/footnote.ts | Adds a small widget to render an inserted display-only suffix (e.g., a space) after :. |
Review details
Suppressed comments (1)
src/hiddenSyntax/link.ts:97
- The footnote reference regex is currently hard to read (
/\[\^[^\][\s]+\]/g) because of the mixed escaping inside the character class. Rewriting it with explicit escapes improves readability and makes it obvious it excludes[,], and whitespace.
const pattern = /\[\^[^\][\s]+\]/g;
- Files reviewed: 9/11 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟡 Changes recommended
revealLinkTarget dispatches a SelectionRange as the transaction selection, which should be an EditorSelection (or {anchor, head}) and can break navigation at runtime.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 9/11 changed files
- Comments generated: 1
- Review effort level: Lite
No description provided.