mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
feat(55737): JSDoc {@link} support all 4 types of links (#56244)
This commit is contained in:
parent
4d3418205c
commit
f0d2cadd7d
@ -2977,7 +2977,8 @@ export function buildLinkParts(link: JSDocLink | JSDocLinkCode | JSDocLinkPlain,
|
||||
if (text) parts.push(linkTextPart(text));
|
||||
}
|
||||
else {
|
||||
parts.push(linkTextPart(name + (suffix ? "" : " ") + text));
|
||||
const separator = suffix === 0 || (link.text.charCodeAt(suffix) === CharacterCodes.bar && name.charCodeAt(name.length - 1) !== CharacterCodes.space) ? " " : "";
|
||||
parts.push(linkTextPart(name + separator + text));
|
||||
}
|
||||
}
|
||||
parts.push(linkPart("}"));
|
||||
|
||||
121
tests/baselines/reference/quickInfoLink11.baseline
Normal file
121
tests/baselines/reference/quickInfoLink11.baseline
Normal file
@ -0,0 +1,121 @@
|
||||
// === QuickInfo ===
|
||||
=== /tests/cases/fourslash/quickInfoLink11.ts ===
|
||||
// /**
|
||||
// * {@link https://vscode.dev}
|
||||
// * [link text]{https://vscode.dev}
|
||||
// * {@link https://vscode.dev|link text}
|
||||
// * {@link https://vscode.dev link text}
|
||||
// */
|
||||
// function f() {}
|
||||
//
|
||||
// f();
|
||||
// ^
|
||||
// | ----------------------------------------------------------------------
|
||||
// | function f(): void
|
||||
// | {@link https://vscode.dev}
|
||||
// | [link text]{https://vscode.dev}
|
||||
// | {@link https://vscode.dev link text}
|
||||
// | {@link https://vscode.dev link text}
|
||||
// | ----------------------------------------------------------------------
|
||||
|
||||
[
|
||||
{
|
||||
"marker": {
|
||||
"fileName": "/tests/cases/fourslash/quickInfoLink11.ts",
|
||||
"position": 170,
|
||||
"name": ""
|
||||
},
|
||||
"item": {
|
||||
"kind": "function",
|
||||
"kindModifiers": "",
|
||||
"textSpan": {
|
||||
"start": 170,
|
||||
"length": 1
|
||||
},
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "function",
|
||||
"kind": "keyword"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "f",
|
||||
"kind": "functionName"
|
||||
},
|
||||
{
|
||||
"text": "(",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": ")",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": ":",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "void",
|
||||
"kind": "keyword"
|
||||
}
|
||||
],
|
||||
"documentation": [
|
||||
{
|
||||
"text": "",
|
||||
"kind": "text"
|
||||
},
|
||||
{
|
||||
"text": "{@link ",
|
||||
"kind": "link"
|
||||
},
|
||||
{
|
||||
"text": "https://vscode.dev",
|
||||
"kind": "linkText"
|
||||
},
|
||||
{
|
||||
"text": "}",
|
||||
"kind": "link"
|
||||
},
|
||||
{
|
||||
"text": "\n[link text]{https://vscode.dev}\n",
|
||||
"kind": "text"
|
||||
},
|
||||
{
|
||||
"text": "{@link ",
|
||||
"kind": "link"
|
||||
},
|
||||
{
|
||||
"text": "https://vscode.dev link text",
|
||||
"kind": "linkText"
|
||||
},
|
||||
{
|
||||
"text": "}",
|
||||
"kind": "link"
|
||||
},
|
||||
{
|
||||
"text": "\n",
|
||||
"kind": "text"
|
||||
},
|
||||
{
|
||||
"text": "{@link ",
|
||||
"kind": "link"
|
||||
},
|
||||
{
|
||||
"text": "https://vscode.dev link text",
|
||||
"kind": "linkText"
|
||||
},
|
||||
{
|
||||
"text": "}",
|
||||
"kind": "link"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
13
tests/cases/fourslash/quickInfoLink11.ts
Normal file
13
tests/cases/fourslash/quickInfoLink11.ts
Normal file
@ -0,0 +1,13 @@
|
||||
///<reference path="fourslash.ts" />
|
||||
|
||||
/////**
|
||||
//// * {@link https://vscode.dev}
|
||||
//// * [link text]{https://vscode.dev}
|
||||
//// * {@link https://vscode.dev|link text}
|
||||
//// * {@link https://vscode.dev link text}
|
||||
//// */
|
||||
////function f() {}
|
||||
////
|
||||
/////**/f();
|
||||
|
||||
verify.baselineQuickInfo();
|
||||
Loading…
x
Reference in New Issue
Block a user