Build tag text correctly for all tags#81
Build tag text correctly for all tags#81alexdima merged 2 commits intomicrosoft:mainfrom spahnke:deprecated-hover-fix
Conversation
| if (rest.length > 0) tagLabel += ` — ${rest.map(r => r.text).join(' ')}`; | ||
| } else if (tag.text) { | ||
| tagLabel += ` — ${tag.text}`; | ||
| tagLabel += ` — ${tag.text.map(r => r.text).join(' ')}`; |
There was a problem hiding this comment.
Looks like this is determined by a user option: UserPreferences.displayPartsForJSDoc
So I think this is close, but it could be either a string or the array and so we probably want to handle that as a separate if?
export interface JSDocTagInfo {
/** Name of the JSDoc tag */
name: string;
/**
* Comment text after the JSDoc tag -- the text after the tag name until the next tag or end of comment
* Display parts when UserPreferences.displayPartsForJSDoc is true, flattened to string otherwise.
*/
text?: string | SymbolDisplayPart[];
}
There was a problem hiding this comment.
I pushed a change to accomodate for that. Where does the discrepancy in typescriptServices.d.ts come from though? I don't see the string option there
interface JSDocTagInfo {
name: string;
text?: SymbolDisplayPart[];
}There was a problem hiding this comment.
IMO, this is likely a bug in the compiler codebase - there are a few types which end up repeated in services vs the compiler. For this example, typescriptServices.d.ts has both:
// 6123
interface JSDocTagInfo {
name: string;
text?: SymbolDisplayPart[];
}
// 7433
interface JSDocTagInfo {
/** Name of the JSDoc tag */
name: string;
/**
* Comment text after the JSDoc tag -- the text after the tag name until the next tag or end of comment
* Display parts when UserPreferences.displayPartsForJSDoc is true, flattened to string otherwise.
*/
text?: string | SymbolDisplayPart[];
}
It compiles fine because of interface merging - I'll make a PR which makes them consistent to the compiler and see what someone closer to the codebase thinks
There was a problem hiding this comment.
Ah, that makes sense. Thank you for the fast review on this PR!
|
Thank you! |
Fixes microsoft/monaco-editor#2523
Is this the correct way for all tag types? The typings suggest that
tag.textis now always an array./cc @orta