Skip to content

Commit 11ee01b

Browse files
authored
Add missing whitespace after type parameter's modifiers in interactive inlay hints (#62246)
1 parent 8ea03f8 commit 11ee01b

File tree

3 files changed

+89
-0
lines changed

3 files changed

+89
-0
lines changed

src/services/inlayHints.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ export function provideInlayHints(context: InlayHintsContext): InlayHint[] {
582582
Debug.assertNode(node, isTypeParameterDeclaration);
583583
if (node.modifiers) {
584584
visitDisplayPartList(node.modifiers, " ");
585+
parts.push({ text: " " });
585586
}
586587
visitForDisplayParts(node.name);
587588
if (node.constraint) {
@@ -597,6 +598,7 @@ export function provideInlayHints(context: InlayHintsContext): InlayHint[] {
597598
Debug.assertNode(node, isParameter);
598599
if (node.modifiers) {
599600
visitDisplayPartList(node.modifiers, " ");
601+
parts.push({ text: " " });
600602
}
601603
if (node.dotDotDotToken) {
602604
parts.push({ text: "..." });
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// === Inlay Hints ===
2+
function test1() {
3+
^
4+
{
5+
"text": "",
6+
"displayParts": [
7+
{
8+
"text": ": "
9+
},
10+
{
11+
"text": "<"
12+
},
13+
{
14+
"text": "const"
15+
},
16+
{
17+
"text": " "
18+
},
19+
{
20+
"text": "T",
21+
"span": {
22+
"start": 44,
23+
"length": 1
24+
},
25+
"file": "/tests/cases/fourslash/inlayHintsTypeParameterModifiers1.ts"
26+
},
27+
{
28+
"text": ">"
29+
},
30+
{
31+
"text": "("
32+
},
33+
{
34+
"text": "a"
35+
},
36+
{
37+
"text": ": "
38+
},
39+
{
40+
"text": "T",
41+
"span": {
42+
"start": 44,
43+
"length": 1
44+
},
45+
"file": "/tests/cases/fourslash/inlayHintsTypeParameterModifiers1.ts"
46+
},
47+
{
48+
"text": ")"
49+
},
50+
{
51+
"text": " => "
52+
},
53+
{
54+
"text": "void"
55+
}
56+
],
57+
"position": 16,
58+
"kind": "Type",
59+
"whitespaceBefore": true
60+
}
61+
62+
return function <const T>(a: T) {};
63+
^
64+
{
65+
"text": "",
66+
"displayParts": [
67+
{
68+
"text": ": "
69+
},
70+
{
71+
"text": "void"
72+
}
73+
],
74+
"position": 52,
75+
"kind": "Type",
76+
"whitespaceBefore": true
77+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
///<reference path="fourslash.ts" />
2+
3+
//// function test1() {
4+
//// return function <const T>(a: T) {};
5+
//// }
6+
7+
verify.baselineInlayHints(undefined, {
8+
interactiveInlayHints: true,
9+
includeInlayFunctionLikeReturnTypeHints: true,
10+
});

0 commit comments

Comments
 (0)