TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

JSX `JsxNamespacedName` breaks JSDoc + QuickInfo in VSCode

Open JulianCataldo opened this issue 9 months ago • 0 comments

🔎 Search Terms

jsx namespace identifier attribute name js docs quick info language service completion documentation

🕗 Version & Regression Information

  • Verified on TS 5.x and VSCode 1.8x

⏯ Playground Link

No response

💻 Code

```tsx
<my-el prop:foo="bar" />
declare namespace JSX {
  interface IntrinsicElements {
    'my-el': {
      /** This appears */
      foo: string;

      /** This does NOT appear */
      'prop:foo': string;
    };
  }
}

🙁 Actual behavior

Summary

When using namespaced JSX attributes like prop:foo or on:bar, the TypeScript language service resolves the type correctly, but:

  • ❌ JSDoc comments are ignored (both in .d.ts and when injected via plugin)
  • displayParts from custom getQuickInfoAtPosition() overrides are not shown
  • ❌ Hover rendering is syntactically different, bypassing normal symbol resolution

Observations

  • "foo" shows hover JSDoc properly
  • "prop:foo" fails to render documentation
  • TypeScript does emit the correct type errors and binding
  • Even a custom TypeScript language service plugin that injects a QuickInfo object with displayParts and documentation cannot override the behavior
  • VSCode always renders the shadow hover produced by TypeScript internally
Image Image

Note the sublte differences for quoting behavior:

Image Image

Inferred Cause

  • JsxNamespacedName is not fully integrated into the symbol-based resolution flow used for QuickInfo
  • TS returns a QuickInfo that VSCode renders but does not allow to be overridden or augmented, breaking hover DX
  • The rendered hover is syntactically different (highlighted on:stuff vs quoted "stuff"), indicating it's a non-standard code path

Possible Fix

  • Ensure that JsxNamespacedName attributes go through the same getSymbolDisplayPartsDocumentationAndSymbolKind() or equivalent path
  • Allow plugin-based QuickInfo responses to override this behavior consistently

🙂 Expected behavior

Aligned with non namespaced attributes, show the JSDocs block as it should.

Additional information about the issue

  • This affects authoring DX for Custom Elements with namespaced props
  • May also affect users of JSX-like DSLs (e.g., Astro, Solid, Gracile, etc.)

JulianCataldo avatar Jun 06 '25 08:06 JulianCataldo