File tree 12 files changed +344
-5
lines changed
12 files changed +344
-5
lines changed Original file line number Diff line number Diff line change @@ -2307,13 +2307,15 @@ namespace ts {
2307
2307
: "linkplain" ;
2308
2308
const parts = [ linkPart ( `{@${ prefix } ` ) ] ;
2309
2309
if ( ! link . name ) {
2310
- if ( link . text ) parts . push ( linkTextPart ( link . text ) ) ;
2310
+ if ( link . text ) {
2311
+ parts . push ( linkTextPart ( link . text ) ) ;
2312
+ }
2311
2313
}
2312
2314
else {
2313
2315
const symbol = checker ?. getSymbolAtLocation ( link . name ) ;
2314
2316
const suffix = findLinkNameEnd ( link . text ) ;
2315
2317
const name = getTextOfNode ( link . name ) + link . text . slice ( 0 , suffix ) ;
2316
- const text = link . text . slice ( suffix ) ;
2318
+ const text = skipSeparatorFromLinkText ( link . text . slice ( suffix ) ) ;
2317
2319
const decl = symbol ?. valueDeclaration || symbol ?. declarations ?. [ 0 ] ;
2318
2320
if ( decl ) {
2319
2321
parts . push ( linkNamePart ( name , decl ) ) ;
@@ -2327,6 +2329,15 @@ namespace ts {
2327
2329
return parts ;
2328
2330
}
2329
2331
2332
+ function skipSeparatorFromLinkText ( text : string ) {
2333
+ let pos = 0 ;
2334
+ if ( text . charCodeAt ( pos ++ ) === CharacterCodes . bar ) {
2335
+ while ( pos < text . length && text . charCodeAt ( pos ) === CharacterCodes . space ) pos ++ ;
2336
+ return text . slice ( pos ) ;
2337
+ }
2338
+ return text ;
2339
+ }
2340
+
2330
2341
function findLinkNameEnd ( text : string ) {
2331
2342
if ( text . indexOf ( "()" ) === 0 ) return 2 ;
2332
2343
if ( text [ 0 ] !== "<" ) return 0 ;
Original file line number Diff line number Diff line change 141
141
}
142
142
},
143
143
{
144
- "text": "| postfix text",
144
+ "text": "postfix text",
145
145
"kind": "linkText"
146
146
},
147
147
{
Original file line number Diff line number Diff line change 141
141
}
142
142
},
143
143
{
144
- "text": "| postfix text",
144
+ "text": "postfix text",
145
145
"kind": "linkText"
146
146
},
147
147
{
Original file line number Diff line number Diff line change 141
141
}
142
142
},
143
143
{
144
- "text": "| postfix text",
144
+ "text": "postfix text",
145
145
"kind": "linkText"
146
146
},
147
147
{
Original file line number Diff line number Diff line change
1
+ [
2
+ {
3
+ "marker": {
4
+ "fileName": "/tests/cases/fourslash/quickInfoLink5.ts",
5
+ "position": 67,
6
+ "name": ""
7
+ },
8
+ "quickInfo": {
9
+ "kind": "const",
10
+ "kindModifiers": "",
11
+ "textSpan": {
12
+ "start": 67,
13
+ "length": 1
14
+ },
15
+ "displayParts": [
16
+ {
17
+ "text": "const",
18
+ "kind": "keyword"
19
+ },
20
+ {
21
+ "text": " ",
22
+ "kind": "space"
23
+ },
24
+ {
25
+ "text": "B",
26
+ "kind": "localName"
27
+ },
28
+ {
29
+ "text": ":",
30
+ "kind": "punctuation"
31
+ },
32
+ {
33
+ "text": " ",
34
+ "kind": "space"
35
+ },
36
+ {
37
+ "text": "456",
38
+ "kind": "stringLiteral"
39
+ }
40
+ ],
41
+ "documentation": [
42
+ {
43
+ "text": "See ",
44
+ "kind": "text"
45
+ },
46
+ {
47
+ "text": "{@link ",
48
+ "kind": "link"
49
+ },
50
+ {
51
+ "text": "A",
52
+ "kind": "linkName",
53
+ "target": {
54
+ "fileName": "/tests/cases/fourslash/quickInfoLink5.ts",
55
+ "textSpan": {
56
+ "start": 6,
57
+ "length": 7
58
+ }
59
+ }
60
+ },
61
+ {
62
+ "text": "constant A",
63
+ "kind": "linkText"
64
+ },
65
+ {
66
+ "text": "}",
67
+ "kind": "link"
68
+ },
69
+ {
70
+ "text": " instead",
71
+ "kind": "text"
72
+ }
73
+ ]
74
+ }
75
+ }
76
+ ]
Original file line number Diff line number Diff line change
1
+ [
2
+ {
3
+ "marker": {
4
+ "fileName": "/tests/cases/fourslash/quickInfoLink6.ts",
5
+ "position": 67,
6
+ "name": ""
7
+ },
8
+ "quickInfo": {
9
+ "kind": "const",
10
+ "kindModifiers": "",
11
+ "textSpan": {
12
+ "start": 67,
13
+ "length": 1
14
+ },
15
+ "displayParts": [
16
+ {
17
+ "text": "const",
18
+ "kind": "keyword"
19
+ },
20
+ {
21
+ "text": " ",
22
+ "kind": "space"
23
+ },
24
+ {
25
+ "text": "B",
26
+ "kind": "localName"
27
+ },
28
+ {
29
+ "text": ":",
30
+ "kind": "punctuation"
31
+ },
32
+ {
33
+ "text": " ",
34
+ "kind": "space"
35
+ },
36
+ {
37
+ "text": "456",
38
+ "kind": "stringLiteral"
39
+ }
40
+ ],
41
+ "documentation": [
42
+ {
43
+ "text": "See ",
44
+ "kind": "text"
45
+ },
46
+ {
47
+ "text": "{@link ",
48
+ "kind": "link"
49
+ },
50
+ {
51
+ "text": "A",
52
+ "kind": "linkName",
53
+ "target": {
54
+ "fileName": "/tests/cases/fourslash/quickInfoLink6.ts",
55
+ "textSpan": {
56
+ "start": 6,
57
+ "length": 7
58
+ }
59
+ }
60
+ },
61
+ {
62
+ "text": "constant A",
63
+ "kind": "linkText"
64
+ },
65
+ {
66
+ "text": "}",
67
+ "kind": "link"
68
+ },
69
+ {
70
+ "text": " instead",
71
+ "kind": "text"
72
+ }
73
+ ]
74
+ }
75
+ }
76
+ ]
Original file line number Diff line number Diff line change
1
+ [
2
+ {
3
+ "marker": {
4
+ "fileName": "/tests/cases/fourslash/quickInfoLink7.ts",
5
+ "position": 46,
6
+ "name": ""
7
+ },
8
+ "quickInfo": {
9
+ "kind": "const",
10
+ "kindModifiers": "",
11
+ "textSpan": {
12
+ "start": 46,
13
+ "length": 1
14
+ },
15
+ "displayParts": [
16
+ {
17
+ "text": "const",
18
+ "kind": "keyword"
19
+ },
20
+ {
21
+ "text": " ",
22
+ "kind": "space"
23
+ },
24
+ {
25
+ "text": "B",
26
+ "kind": "localName"
27
+ },
28
+ {
29
+ "text": ":",
30
+ "kind": "punctuation"
31
+ },
32
+ {
33
+ "text": " ",
34
+ "kind": "space"
35
+ },
36
+ {
37
+ "text": "456",
38
+ "kind": "stringLiteral"
39
+ }
40
+ ],
41
+ "documentation": [
42
+ {
43
+ "text": "See ",
44
+ "kind": "text"
45
+ },
46
+ {
47
+ "text": "{@link ",
48
+ "kind": "link"
49
+ },
50
+ {
51
+ "text": "| ",
52
+ "kind": "linkText"
53
+ },
54
+ {
55
+ "text": "}",
56
+ "kind": "link"
57
+ },
58
+ {
59
+ "text": " instead",
60
+ "kind": "text"
61
+ }
62
+ ]
63
+ }
64
+ }
65
+ ]
Original file line number Diff line number Diff line change
1
+ [
2
+ {
3
+ "marker": {
4
+ "fileName": "/tests/cases/fourslash/quickInfoLink8.ts",
5
+ "position": 67,
6
+ "name": ""
7
+ },
8
+ "quickInfo": {
9
+ "kind": "const",
10
+ "kindModifiers": "",
11
+ "textSpan": {
12
+ "start": 67,
13
+ "length": 1
14
+ },
15
+ "displayParts": [
16
+ {
17
+ "text": "const",
18
+ "kind": "keyword"
19
+ },
20
+ {
21
+ "text": " ",
22
+ "kind": "space"
23
+ },
24
+ {
25
+ "text": "B",
26
+ "kind": "localName"
27
+ },
28
+ {
29
+ "text": ":",
30
+ "kind": "punctuation"
31
+ },
32
+ {
33
+ "text": " ",
34
+ "kind": "space"
35
+ },
36
+ {
37
+ "text": "456",
38
+ "kind": "stringLiteral"
39
+ }
40
+ ],
41
+ "documentation": [
42
+ {
43
+ "text": "See ",
44
+ "kind": "text"
45
+ },
46
+ {
47
+ "text": "{@link ",
48
+ "kind": "link"
49
+ },
50
+ {
51
+ "text": "A",
52
+ "kind": "linkName",
53
+ "target": {
54
+ "fileName": "/tests/cases/fourslash/quickInfoLink8.ts",
55
+ "textSpan": {
56
+ "start": 6,
57
+ "length": 7
58
+ }
59
+ }
60
+ },
61
+ {
62
+ "text": "constant A",
63
+ "kind": "linkText"
64
+ },
65
+ {
66
+ "text": "}",
67
+ "kind": "link"
68
+ },
69
+ {
70
+ "text": " instead",
71
+ "kind": "text"
72
+ }
73
+ ]
74
+ }
75
+ }
76
+ ]
Original file line number Diff line number Diff line change
1
+ /// <reference path="fourslash.ts" />
2
+
3
+ ////const A = 123;
4
+ /////**
5
+ //// * See {@link A| constant A } instead
6
+ //// */
7
+ ////const /**/B = 456;
8
+
9
+ verify . baselineQuickInfo ( ) ;
Original file line number Diff line number Diff line change
1
+ /// <reference path="fourslash.ts" />
2
+
3
+ ////const A = 123;
4
+ /////**
5
+ //// * See {@link A |constant A } instead
6
+ //// */
7
+ ////const /**/B = 456;
8
+
9
+ verify . baselineQuickInfo ( ) ;
Original file line number Diff line number Diff line change
1
+ /// <reference path="fourslash.ts" />
2
+
3
+ /////**
4
+ //// * See {@link | } instead
5
+ //// */
6
+ ////const /**/B = 456;
7
+
8
+ verify . baselineQuickInfo ( ) ;
You can’t perform that action at this time.
0 commit comments