Skip to content

Better way and guide to documenting components. #516

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

Open
TheComputerM opened this issue Sep 2, 2020 · 3 comments
Open

Better way and guide to documenting components. #516

TheComputerM opened this issue Sep 2, 2020 · 3 comments
Labels
feature request New feature or request

Comments

@TheComputerM
Copy link

I am now sure whether to post the issue here or the svelte repo.
There is no standard tooling and easy way to document svelte components.

Describe the solution you'd like
Something like https://vue-styleguidist.github.io/docs/Documenting.html#documenting-components with reserved JSDoc keywords. It will make for better autocomplete and definitions in VSCode and other editors.

@dummdidumm
Copy link
Member

I'm not sure what you are aiming for. You talk about documenting components and link to something that outputs a specific format which can be presented as a documentation page which you can browse. But then you talk about autocomplete/definitions in IDEs. Could you specifiy what exactly you envision?

@TheComputerM
Copy link
Author

TheComputerM commented Sep 3, 2020

Sorry for not being specific, was in a hurry before.
As you can see there are definitions of components when we start to write them, preview. This gives us more information on the component and also gives us a glimpse on how to use them.

This can also be replicated for component props, when writing them, the language server can give hints provided by the component author on how to use the props and what they do. This is mentioned in the faq. (although we cannot specify if the prop is a boolean, string or number)

However, there is no way to do the same with slots, actions and events, so I was trying to say what if we use specific JSDoc keywords to provide more information on them, something like this.

I do not know if there is a better way to do this, but providing in-editor descriptions and definitions of props, slots and actions for components does seem very useful to have.

@dummdidumm
Copy link
Member

dummdidumm commented Sep 3, 2020

Okay I think I understand you now. So you want doc info on hover/completion for props, slots, events, actions in the IDE.

  • Props doc is tracked here Make docstrings for props available on hover from consuming component #306
  • Events doc is possible right now through defining ComponentEvents as described here. We will look into implementing it for the new createEventDispatcher typings, too. Both of these solutions require you to use TypeScript. A JS solution would need to be found, too.
  • You can provide docs for actions by just adding JSDoc to that action function. Same for transitions/animations.
  • Slots documentation is missing right now, true - we need to come up with something

@dummdidumm dummdidumm added the feature request New feature or request label Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants