-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Add see tag support #39760
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 see tag support #39760
Conversation
Friendly ping @sandersn . I'm not sure what is the expected of |
Couple of quick comments -- I've only glanced at the code, haven't really read it yet.
|
Hoops. Seems not my fault. |
UP ↑ |
@sandersn Is that a valid syntax?... I'm not sure what are you expected... @typescript-bot pack this. |
Hey @Kingwl, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build. |
Based on my comment on the original bug, here are some more test cases that need to be added. They don't have to pass, but I want to make sure they don't crash:
I'm going to do a bit more looking to see how well we'll be able to resolve module references in things like lodash. I think a lot of uses just make up a name for the module they are inside, even though it's never declared inside the module itself. |
The only question I have left before merging this is how to resolve /** @param x @see x */
function f(x) { } Right now, But I don't actually think people write this. I'm going to figure out if that's the case. Either way, I think the best thing is to resolve starting from the parameter list of a function declaration. |
Maybe we could peek the parameters first if jsdoc attached on a function like declaration. |
If we resolveName starting from the parameter list, I think you can get it to resolve to just the parameter. So |
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.
My suggestion fixes the parameter name resolution, still need a test like
const x = 1
/** @see x */
function f(x) { }
To make sure that x
resolves to the parameter.
Could someone from the TS team please clarify if this current |
Work on Can you add a deeper link to the tsdoc syntax you're talking about? I talked with @octogonz and concluded that TS should attempt to support a basic subset of entity names. @rbuckton pointed me to a grammar he made, but I'd have to look through my notes to find the link. Edit: Here is what we're targetting in the near term: #35524 (comment) |
The TSDoc spec for /**
* Parses a string containing a Uniform Resource Locator (URL).
* @see {@link ParsedUrl} for the returned data structure
* @see {@link https://tools.ietf.org/html/rfc1738|RFC 1738}
* for syntax
* @see your developer SDK for code samples
* @param url - the string to be parsed
* @returns the parsed result
*/
function parseURL(url: string): ParsedUrl; |
TSDoc and the compiler seem to take somewhat different approaches today:
As such TSDoc would be a somewhat heavyweight piece to incorporate into the compiler. (Not in terms of kilobytes, but in terms of complexity and upkeep.) And doing so might drag the compiler into the rabbit hole of enterprise documentation systems, which is a delightful but surprisingly complex space. This would benefit developers who write rich documentation and adopt TSDoc, but they are a minority. So the current situation is understandable, if not ideal. An easy way out would be for the compiler to expose a plugin API enabling its comment parser to be replaced. This way, developers could opt-in to TSDoc, and there wouldn't need to be any close coordination between the two projects. This idea was brought up in my last chat with the TypeScript folks, and it seemed to align pretty well with their roadmap for extensibility. It seems like a feasible and pretty good solution. |
There's a weird thing going on right now where |
🍾 |
Fixes a part of #35524