language-tools icon indicating copy to clipboard operation
language-tools copied to clipboard

✨ Use custom element's JSDoc as doc for completion/hover

Open ouvreboite opened this issue 1 month ago • 3 comments

Currently, custom elements added to SvelteHTMLElements supports autocompletion, but no description is displayed (from the JSDoc), while their attributes support both autocompletion and JSDoc description.

This PR's goal is to enable JSDoc documentation during autocompletion and hover for custom element's tags.

For example, this declaration would yield this autocomplete:

declare module 'svelte/elements' {
  export interface SvelteHTMLElements {
    /** 
     * Custom doc for custom element 
     * 
     * ### Details
     * Some interesting stuff about this component (in markdown)
    */
    'custom-element': any;
  }
}

ouvreboite avatar Nov 02 '25 16:11 ouvreboite

⚠️ No Changeset found

Latest commit: 6a70acadf1464e4b3547427dbade028d786dcfe2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Nov 02 '25 16:11 changeset-bot[bot]

I think it would be better to resolve the documentation in resolveCompletion. Could you check if it's possible? This way, it'll only calculate the documentation when it's needed. In hover, the reused method also only needs to calculate the documentation needed instead of all the customer elements.

jasonlyu123 avatar Nov 06 '25 13:11 jasonlyu123

I'm away from home the next few days, but I'll look into that shortly.

ouvreboite avatar Nov 07 '25 08:11 ouvreboite