-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add documentation snippets to the k6/* type definitions #1069
Comments
Working toward this in |
Here's what vscode looks like with the descriptions. @ppcano You might be interested in this. |
@bookmoons 👏😍 Please, could you tell us how are you generating the markdown files? I asked you because we plan to create a new documentation website for k6 (replacing the existing readme website). I talked with @na-- about how we could have "independent" markdown files for the API docs that can be imported into the new documentation website. This is similar to what you have done with the above themes. Could the TSdocs include a section (like https://github.com/Microsoft/tsdoc#what-are-the-goals
@na-- I think we should continue exploring this solution. |
Did it with API Extractor.
Haven't seen something that does this but I'm not familiar with everything yet. There's the syntax. Maybe that |
Think I have my head around the doc language and I have a good model down. I'm ready to blast through the rest of these descriptions. Can I ask if you guys have an idea what you're thinking about the docs? I know you've mentioned the issue with duplicating them, which is such a pain to maintain. I'm wondering whether I should go for as much as possible so they can generate useful docs, or minimal so they're not creating a maintenance load. I can hold off for now if it needs some percolation time. |
Poked around the vscode rendering a little. Examples show in intellisense. Even custom tags show in intellisense. It just lists everything. Not sure there's any way right now to define things just for docs. /**
* @notATag Custom tag not in standard TSDoc.
*/
export function foo(): void; Mentioned this as a possible feature in microsoft/vscode#77261. |
Now that things have percolated for a few days, I think I have a reasonably good idea about the pros and cons regarding the API docs in the DefinitelyTyped repository. Pros of having the whole API documentation there:
Cons:
So, in short, I think minimal docs (at most, a few short sentences per method, with a link to the actual docs) in the DefinitelyTyped repo is the way to go for now, despite causing minor duplication of the docs. We can revisit that in the future, if the VSCode issue is addressed and if we can bring those type definitions in our repo... @mstoykov , @ppcano , @bookmoons , @robingustafsson - thoughts? |
LGTM.
I am not sure if this makes sense, but we can test it and see. |
It seems sensible. For whatever it's worth, TSDoc and VSCode both seem unreceptive. VSCode has already closed the issue. microsoft/tsdoc#170 microsoft/vscode#77261 Proposed format:
/**
* Initiate a WebSocket connection to a remote host.
* https://docs.k6.io/docs/connect-url-params-func
*
* @param url - Request URL (e.g. "ws://echo.websocket.org").
* @param params - Additional request parameters.
* @param callback - Called when the connection is initiated.
* @returns HTTP Response object.
*/
export function connect(url: string, params: Params | null, callback: Callback): Response; Here's how it comes out. The link is clickable. Full docs for comparison. Extended description of the behavior is left out. Longer description of the |
The proposed format LGTM |
Alright, thanks guys. Heading that way. |
In Should I maybe take that out of the types? |
Apparently those just denote which items in the menu list are functions/methods and we forgot to mark some of the newer pages. Unfortunately, I have absolutely no idea how to change that, I can't find such an option in the interface 😕 We need to get out of readme.io and start hosting the docs as a static site we generate...
Yeah, that was actually one of the reasons for the type definition fixes: #929 (comment) I just forgot to make sure it was taken out when I skimmed over the new definitions 😊 |
Copy that. |
btw current idea is to bring back |
Opened DefinitelyTyped/DefinitelyTyped#37045 to remove |
|
Some details: Function types pull information from different doc comments. I settled on this pattern to get them to render right everywhere. Type params and release tag on the interface. Params and return on the signature. Summary line duplicated. /**
* Check procedure.
* @typeParam VT - Value type.
* @public
*/
export interface Checker<VT> {
/**
* Check procedure.
* @param val - Value to check.
* @returns Whether check passed.
*/
(val: VT): boolean;
} I linked all HTML elements to the Element page. They're not all listed but I guess it's the closest thing. Tried to include an API Extractor config file to support validating doc comments. It works nicely for that. But the repo doesn't like the config file. Tests fail with the file there. I have a question open about this: |
These docs are merged and published. DefinitelyTyped/DefinitelyTyped#37056 |
Thanks, @bookmoons, closing this now. |
As discussed in #929 (comment), docs in the type definitions would be a nice feature to have, since they can be useful when shown in the auto-complete popups. Of course, I doubt we can fit the full docs, but short descriptions should suffice, especially if we can also add links to the full docs for each object and function?
The text was updated successfully, but these errors were encountered: