-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
(svelte2tsx) Allow documenting components with a tagged HTML comment #285
(svelte2tsx) Allow documenting components with a tagged HTML comment #285
Conversation
Wonder if we could allow jsdoc in this documentation block. Something like something like this
|
@jasonlyu123 Yup, TSDoc is what you're supposed to write in it. It will be picked up by editors and rendered correctly. Unless I'm missimg something. The additional |
Haven't used to refer it with the new tsdoc standard ms is pushing lol |
|
@jasonlyu123 I see, sorry then, I misunderstood your initial post. The implementation I'm going to make just passes along the string to the LSP. Beyond that, I don't know if any additional work needs to be done to support what you suggested. |
@dummdidumm Two points arise from that statement about the test suite:
|
Sounds good!
I think so, yes, the first letter should be capitalized. To me this seems like a standard in the JS/TS world. Classes are always first letter uppercase. Same for components in svelte, at least from what I have seen. Do you know of cases where this is not the case? I think it's more likely that people use first-letter-lower file names than first-letter-lower component imports, that's the rationale behind it. |
Yup, I've also always written component names capitalized. The problem is the user could be using snake case or something else. Maybe I could bring in some utility to transform any case to |
Yes, good point, such transformations should be done. |
AFAIK components needs to have an uppercase first letter to be rendered anyway (except |
aed5019
to
ecef276
Compare
39e52a5
to
e6a983c
Compare
Alright! This is ready for review. I hope you don't find it too controversial :) I've tested it locally and it's working just fine. Maybe you can find some edge case? If you approve it, please point me to where I should document this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Docs go into https://github.com/sveltejs/language-tools/blob/master/docs/README.md , above FAQ / Troubleshooting
as its own section.
e6a983c
to
3890afb
Compare
0792dc0
to
4259fcf
Compare
4259fcf
to
3b64ffd
Compare
🎉 |
Thanks to the work in sveltejs#285, `svelte2tsx` now creates files with named default exports, which makes some code in the `CompletionProvider` obsolete.
Thanks to the work in #285, `svelte2tsx` now creates files with named default exports, which makes some code in the `CompletionProvider` obsolete.
Work like a champ with #301 lol |
Awesome 😄 |
Goal
Solve #280
For example:
Single-line comments should work too. The contents of the HTML comment can then be picked up by the language service provider.
Progress
svelte2tsx
is called with a filename.PascalCase
name for the default-exported class.<!-- @component Documentation string -->
.About the test suite
With this, the test suite is now mostly unrealistic, since all the expected strings use anonymous exports. In most (if not all?) cases,
svelte2tsx
would be called with a filename. Maybe I should update all the tests.To be discussed
Edit: discussion solved, we go for
@component
.Is this HTML comment approach the best? And if so, what should the tag look like? Here are some ideas:
@documentation
@doc
@component
: I like this one better because@doc
or@documentation
sounds a bit vague.@component
specifies what the documentation is about, and it's obvious that it's documentation.Maybe we could support multiple, too.