vuejs / language-tools

⚡ High-performance Vue language tooling based-on Volar.js
https://marketplace.visualstudio.com/items?itemName=Vue.volar
MIT License
5.87k stars 403 forks source link

Enhance Vue Component IDE Tooltips on Hover via JSDoc/TSDoc Comment Annotation #4931

Open nathanchase opened 1 month ago

nathanchase commented 1 month ago

What problem does this feature solve?

Current Behavior

When I hover over an instance of a component - either defined in the <script> or the <template>, the tooltip only shows basic component information without any custom documentation:

image

Expected Behavior

The tooltip should be able to display rich component documentation including:

Attempted Solution

I've tried implementing JSDoc/TSDoc-style documentation::

/**
 * @component Toasts
 * @description A component that renders a list of toast notifications using individual Toast components.
 * @example
 * <template>
 *   <Toasts />
 * </template>
 *
 * @props {none}
 * @emits {none}
 * @see Toast
 */

However, this documentation is not recognized by VSCode when hovering over the component.

Additional Context

Questions

  1. Is this feature possible to implement?
  2. Are there any technical limitations preventing this functionality?
  3. If possible, what would be the recommended approach for implementation?

Environment

What does the proposed solution look like?

Expose the line comment annotations from within a given Vue component to the IDE.