Skip to content

Keep dollar expressions literal in plaintext schema hovers - #409

Merged
1 commit merged into
microsoft:mainfrom
pradeep-ramola:fix/hover-literal-theme-icons
Nov 23, 2026
Merged

1 commit merged into
microsoft:mainfrom
pradeep-ramola:fix/hover-literal-theme-icons

Conversation

@pradeep-ramola

Copy link
Copy Markdown
Contributor

Summary

Fixes #265.

Plain schema descriptions containing $(...) can be rendered as theme icons instead of literal text in VS Code. Escaping Markdown parentheses is insufficient because the Markdown parser removes those escapes before VS Code's subsequent icon rewrite.

Encode dollar signs as $ while converting plaintext schema metadata to Markdown. This preserves the displayed dollar sign but keeps icon-like text out of the intermediate HTML processed by the icon renderer. The existing converter already emits HTML character references for whitespace.

The fix applies to title, description, and enumDescriptions. Explicit markdownDescription and markdownEnumDescriptions remain untouched, including intentional icon syntax and formatting. No public API or dependency changes.

Rendering-order reference: VS Code's Markdown renderer.

Tests

Added 20 tests covering literal icon-like expressions, modified icon names, non-icon dollar expressions, currency, $schema, existing backslashes, and authored Markdown controls. Each plaintext case checks both property-key and property-value hovers. Before the fix, 18 plaintext cases failed and the two Markdown controls passed.

Validation:

  • npm test: 5,465 tests passing, no skips or failures; compilation and all nine lint checks also pass.
  • git diff --check: passed.
  • 18 supplemental rendering checks using VS Code's vendored Marked 14.0.0 parser and Chromium 148.0.7778.96: passed. They verify the actual language-service hover output renders to the expected literal DOM text and leaves no icon-shaped token in intermediate HTML.

The rendering checks exercised Markdown parsing and DOM text, not a full interactive VS Code hover or its complete renderer/sanitizer stack.

AI Assistance

Developed with assistance from OpenAI Codex, including implementation and local test/rendering verification.

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.

[json] JSON Schema Description Dollar Sign Needs To Be Escaped

2 participants