Skip to content

Add syntax hidden footnotes - #187

Merged
cyanzhong merged 1 commit into
mainfrom
develop
Sep 7, 2026
Merged

Add syntax hidden footnotes#187
cyanzhong merged 1 commit into
mainfrom
develop

Conversation

@cyanzhong

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Comment thread src/hiddenSyntax/link.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread src/hiddenSyntax/navigation.ts
@cyanzhong
cyanzhong merged commit d5b6db6 into main Sep 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants