-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Editor support for link tag #41877
Editor support for link tag #41877
Conversation
Probably need to fork the services/server types and provide a conversion with Session.toFileSpan. Not sure where to put the conversion.
In theory this is already better supported, but not sure practise bears that out.
The text of the link is still stored in the comment text, but that's now kept in an object instead of just a string. Each link has the parse for the entity reference, if there is one. Needs lots more tests -- this just makes all the existing jsdoc tests pass.
Thanks for the PR! It looks like you've changed the TSServer protocol in some way. Please ensure that any changes here don't break consumers of the current TSServer API. For some extra review, we'll ping @sheetalkamat, @amcasey, @mjbvz, @minestarks for you. Feel free to loop in other consumers/maintainers if necessary |
@typescript-bot pack this Only thing I’m curious about is if there are some places where JSDoc can go, but otherwise entity names could not go, and therefore might expose a hole in |
Heya @andrewbranch, I've started to run the tarball bundle task on this PR at fce33f1. You can monitor the build here. |
@andrewbranch I indeed tried writing more tests and discovered a hole. I'll put up a commit that makes getSymbolAtLocation work with identifiers in links. |
This is ready for review now. |
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.
The behavior and interface changes generally LGTM. Some suggestions below.
1. Add a cross-file goto-def test. 2. Switch from per-message args to UserPreference.
I think this PR has had enough review to be ready to use. I'll merge it and address any follow-up in subsequent PRs. |
Cool! |
Docs can be updated now https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html |
Fixes #35524 (80% solution)
This PR makes the parser parse
@link
tag and the language service offer symbols for entity names found at the beginning of those tags. Links are stored redundantly with comment text, so they're only used to provide (1) a span to an editor to format in some way (2) a symbol for the declaration of the link's target.Future PRs
#
as type-space element access:Class#method
. As well as, possibly, the normal TS syntaxClass["method"]
, which doesn't currently parse either.Open questions
@see {@link ...}
as a@see
with no reference and a link in its comment text. I think that's OK.{ @link X}
, with a space separating{
and@
. I saw this only twice in my corpus, but @amcasey points out that it's easy to support with an additionalskipWhitespace
call. I originally skipped it because I had slightly less lookahead when the next token after{
was@
, but that made the code unreadable, so I dropped it.Resolved questions