Skip to content

Commit 55ed742

Browse files
authored
fix(45294): show parameter inlay hints for template strings (#45305)
1 parent ab043f9 commit 55ed742

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/services/inlayHints.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,13 @@ namespace ts.InlayHints {
210210
}
211211
case SyntaxKind.TrueKeyword:
212212
case SyntaxKind.FalseKeyword:
213-
case SyntaxKind.ArrowFunction:
214213
case SyntaxKind.FunctionExpression:
214+
case SyntaxKind.ArrowFunction:
215215
case SyntaxKind.ObjectLiteralExpression:
216216
case SyntaxKind.ArrayLiteralExpression:
217217
case SyntaxKind.NullKeyword:
218+
case SyntaxKind.NoSubstitutionTemplateLiteral:
219+
case SyntaxKind.TemplateExpression:
218220
return true;
219221
case SyntaxKind.Identifier: {
220222
const name = (node as Identifier).escapedText;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
////function trace(message: string) {}
4+
////trace(/*a*/`${1}`);
5+
////trace(/*b*/``);
6+
7+
const [a, b] = test.markers();
8+
verify.getInlayHints([
9+
{
10+
text: 'message:',
11+
position: a.position,
12+
kind: ts.InlayHintKind.Parameter,
13+
whitespaceAfter: true
14+
},
15+
{
16+
text: 'message:',
17+
position: b.position,
18+
kind: ts.InlayHintKind.Parameter,
19+
whitespaceAfter: true
20+
}
21+
], undefined, {
22+
includeInlayParameterNameHints: "literals"
23+
});

0 commit comments

Comments
 (0)