-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Improve rendering of JSDoc comment text with displayparts #43390
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
Improve rendering of JSDoc comment text with displayparts #43390
Conversation
Well, I was actually thinking of changing the internal displaypart code to match the tag. The code that needs to change is in src/services/jsDoc.ts:140 -- getCommentDisplayParts. Right now everything results in a textPart (or spacePart), but there are lots more to choose from, many of which match parts of existing jsdoc. See all the -Part functions in src/services/utilities.ts. VS Code already does some formatting itself, so it may be hard to see the difference if you're testing with it. |
Improve rendering of JSDoc comment text with displayparts for: - `@typedef` - `@callback` - `@param` - `@property`
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.
Besides the below comments, there needs to be new tests+baselines for @callback
and @typedef
. At least, I didn't see any in the existing tests.
function addComment(s: string, constructDisplayPartFunc?: ConstructSpecificDisplayPartFunction) { | ||
return comment | ||
? [!!constructDisplayPartFunc ? constructDisplayPartFunc(s) : textPart(s), spacePart(), ...getDisplayPartsFromComment(comment, checker)] | ||
: [textPart(s)]; |
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 is more a note to myself, but all of jsdoc.ts' displayparts code might need to be reworked to use a DisplayPartWriter in a subsequent PR. It looks like that's what the rest of service uses instead of building display parts themselves.
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.
Some style suggestions
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.
Just a couple of cleanup requests
Fixes #43085