-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better type documentation for components #58
Comments
Do you have another extension installed which shows different hovers by any chance? For me, using VS Code with the official Svelte extension, it works as expected: Documenting the default import of a Svelte file (the component): https://svelte.dev/faq#how-do-i-document-my-components |
Thanks @dummdidumm. That helped me figure out it was a Svelte intellisense plugin I had. I've documented the components now like this, following that link: layercake/src/components/AxisX.svelte Lines 9 to 14 in 835941a
It doesn't say whether to document the props also in that html comment block. It works better if you add the comments inline for each prop. They don't show up when you hover over the component itself, but you get better hovers when you hover over each prop... |
Documenting the props like shown in your code snippet is correct. To also show them when hovering on the component itself - that's not supported yet, there's an issue for this where you can voice your opinion: sveltejs/language-tools#1308 |
Awesome, great to know! |
This is now merged and released as 6.0.0 https://github.com/mhkeller/layercake/releases/tag/v6.0.0 |
Currently, all of the components have jsdoc comments but the vs code extension doesn't seem to recognize them well.
The component description only gets pulled in (when hovering over the component's import statement) if the format is such where the
@type
definitions are included in one big comment at the top immediately above the exported variables like this:This yields a popup when imported like this, which is helpful because it has the comment description. It has
undefined
for the props though:In that format the popups over each individual property are also undefined and it pulls in that entire first comment, which isn't great:
When the component is formatted like this:
The top-level hover now loses the main comment, but the individual props are nicely annotated:
But it still shows a lot of
undefined
fields.Any thoughts?
The text was updated successfully, but these errors were encountered: