Improve rendering of JSDoc comment text with displayparts#43390
Improve rendering of JSDoc comment text with displayparts#43390sandersn merged 20 commits intomicrosoft:masterfrom sangxxh:issue/43085-improve-render-jsdoc-comment-with-displayparts
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`
sandersn
left a comment
There was a problem hiding this comment.
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.
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.
sandersn
left a comment
There was a problem hiding this comment.
Just a couple of cleanup requests
Fixes #43085