mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 21:06:50 -05:00
feat(44956): remove hyphen separator (#47777)
This commit is contained in:
@@ -152,14 +152,23 @@ namespace ts.JsDoc {
|
||||
|
||||
function getDisplayPartsFromComment(comment: string | readonly JSDocComment[], checker: TypeChecker | undefined): SymbolDisplayPart[] {
|
||||
if (typeof comment === "string") {
|
||||
return [textPart(comment)];
|
||||
return [textPart(skipSeparatorFromComment(comment))];
|
||||
}
|
||||
return flatMap(
|
||||
comment,
|
||||
node => node.kind === SyntaxKind.JSDocText ? [textPart(node.text)] : buildLinkParts(node, checker)
|
||||
node => node.kind === SyntaxKind.JSDocText ? [textPart(skipSeparatorFromComment(node.text))] : buildLinkParts(node, checker)
|
||||
) as SymbolDisplayPart[];
|
||||
}
|
||||
|
||||
function skipSeparatorFromComment(text: string) {
|
||||
let pos = 0;
|
||||
if (text.charCodeAt(pos++) === CharacterCodes.minus) {
|
||||
while (pos < text.length && text.charCodeAt(pos) === CharacterCodes.space) pos++;
|
||||
return text.slice(pos);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
function getCommentDisplayParts(tag: JSDocTag, checker?: TypeChecker): SymbolDisplayPart[] | undefined {
|
||||
const { comment, kind } = tag;
|
||||
const namePart = getTagNameDisplayPart(kind);
|
||||
|
||||
@@ -386,11 +386,11 @@ x(1)`
|
||||
displayPartsForJSDoc: false,
|
||||
tags: [{
|
||||
name: "param",
|
||||
text: "y - {@link C}"
|
||||
text: "y {@link C}"
|
||||
}],
|
||||
documentation: [{
|
||||
kind: "text",
|
||||
text: "- "
|
||||
text: ""
|
||||
}, {
|
||||
kind: "link",
|
||||
text: "{@link "
|
||||
@@ -425,7 +425,7 @@ x(1)`
|
||||
text: " "
|
||||
}, {
|
||||
kind: "text",
|
||||
text: "- "
|
||||
text: ""
|
||||
}, {
|
||||
kind: "link",
|
||||
text: "{@link "
|
||||
@@ -461,11 +461,11 @@ x(1)`
|
||||
displayPartsForJSDoc: false,
|
||||
tags: [{
|
||||
name: "param",
|
||||
text: "y - {@link C}"
|
||||
text: "y {@link C}"
|
||||
}],
|
||||
documentation: [{
|
||||
kind: "text",
|
||||
text: "- "
|
||||
text: ""
|
||||
}, {
|
||||
kind: "link",
|
||||
text: "{@link "
|
||||
@@ -496,7 +496,7 @@ x(1)`
|
||||
text: " "
|
||||
}, {
|
||||
kind: "text",
|
||||
text: "- "
|
||||
text: ""
|
||||
}, {
|
||||
kind: "link",
|
||||
text: "{@link "
|
||||
@@ -610,7 +610,7 @@ foo`
|
||||
text: " "
|
||||
}, {
|
||||
kind: "text",
|
||||
text: "- see "
|
||||
text: "see "
|
||||
}, {
|
||||
kind: "link",
|
||||
text: "{@link "
|
||||
@@ -641,7 +641,7 @@ foo`
|
||||
displayPartsForJSDoc: false,
|
||||
tags: [{
|
||||
name: "param",
|
||||
text: "x - see {@link C}",
|
||||
text: "x see {@link C}",
|
||||
}],
|
||||
});
|
||||
});
|
||||
@@ -659,7 +659,7 @@ foo`
|
||||
text: " "
|
||||
}, {
|
||||
kind: "text",
|
||||
text: "- see "
|
||||
text: "see "
|
||||
}, {
|
||||
kind: "link",
|
||||
text: "{@link "
|
||||
@@ -686,7 +686,7 @@ foo`
|
||||
displayPartsForJSDoc: false,
|
||||
tags: [{
|
||||
name: "param",
|
||||
text: "x - see {@link C}",
|
||||
text: "x see {@link C}",
|
||||
}],
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user