forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(54458): The inlay hint does not handle TypeScript's spread operat…
…or well (microsoft#54503)
- Loading branch information
1 parent
cbda2fc
commit 67299ed
Showing
8 changed files
with
199 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
////function foo(a: unknown, b: unknown, c: unknown) { } | ||
////function bar(...x: [number, number]) { | ||
//// foo(/*a*/...x, /*c*/3); | ||
////} | ||
|
||
const [a, c] = test.markers(); | ||
|
||
verify.getInlayHints([ | ||
{ | ||
text: 'a:', | ||
position: a.position, | ||
kind: ts.InlayHintKind.Parameter, | ||
whitespaceAfter: true | ||
}, | ||
{ | ||
text: 'c:', | ||
position: c.position, | ||
kind: ts.InlayHintKind.Parameter, | ||
whitespaceAfter: true | ||
}, | ||
], undefined, { | ||
includeInlayParameterNameHints: "all" | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
////function foo(a: unknown, b: unknown, c: unknown, d: unknown) { } | ||
////function bar(...x: [number, number, number]) { | ||
//// foo(/*a*/...x, /*d*/3); | ||
////} | ||
|
||
const [a, d] = test.markers(); | ||
|
||
verify.getInlayHints([ | ||
{ | ||
text: 'a:', | ||
position: a.position, | ||
kind: ts.InlayHintKind.Parameter, | ||
whitespaceAfter: true | ||
}, | ||
{ | ||
text: 'd:', | ||
position: d.position, | ||
kind: ts.InlayHintKind.Parameter, | ||
whitespaceAfter: true | ||
}, | ||
], undefined, { | ||
includeInlayParameterNameHints: "all" | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
////function foo(a: unknown, b: unknown, c: unknown) { } | ||
////function bar(...x: [number, number?]) { | ||
//// foo(/*a*/...x, /*b*/3); | ||
////} | ||
|
||
const [a, b] = test.markers(); | ||
|
||
verify.getInlayHints([ | ||
{ | ||
text: 'a:', | ||
position: a.position, | ||
kind: ts.InlayHintKind.Parameter, | ||
whitespaceAfter: true | ||
}, | ||
{ | ||
text: 'b:', | ||
position: b.position, | ||
kind: ts.InlayHintKind.Parameter, | ||
whitespaceAfter: true | ||
}, | ||
], undefined, { | ||
includeInlayParameterNameHints: "all" | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
////function foo(a: unknown, b: unknown, c: unknown) { } | ||
////function bar(...x: [number, number?]) { | ||
//// foo(/*a*/1, /*b*/...x); | ||
////} | ||
|
||
const [a, b] = test.markers(); | ||
|
||
verify.getInlayHints([ | ||
{ | ||
text: 'a:', | ||
position: a.position, | ||
kind: ts.InlayHintKind.Parameter, | ||
whitespaceAfter: true | ||
}, | ||
{ | ||
text: 'b:', | ||
position: b.position, | ||
kind: ts.InlayHintKind.Parameter, | ||
whitespaceAfter: true | ||
}, | ||
], undefined, { | ||
includeInlayParameterNameHints: "all" | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
////function foo(a: unknown, b: unknown, c: unknown) { } | ||
////function bar(...x: [number, number | undefined]) { | ||
//// foo(/*a*/...x, /*c*/3); | ||
////} | ||
|
||
const [a, b] = test.markers(); | ||
|
||
verify.getInlayHints([ | ||
{ | ||
text: 'a:', | ||
position: a.position, | ||
kind: ts.InlayHintKind.Parameter, | ||
whitespaceAfter: true | ||
}, | ||
{ | ||
text: 'c:', | ||
position: b.position, | ||
kind: ts.InlayHintKind.Parameter, | ||
whitespaceAfter: true | ||
}, | ||
], undefined, { | ||
includeInlayParameterNameHints: "all" | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
////function foo(a: unknown, b: unknown, c: unknown) { } | ||
////function bar(...x: []) { | ||
//// foo(...x, /*a*/1, /*b*/2, /*c*/3); | ||
////} | ||
|
||
const [a, b, c] = test.markers(); | ||
|
||
verify.getInlayHints([ | ||
{ | ||
text: 'a:', | ||
position: a.position, | ||
kind: ts.InlayHintKind.Parameter, | ||
whitespaceAfter: true | ||
}, | ||
{ | ||
text: 'b:', | ||
position: b.position, | ||
kind: ts.InlayHintKind.Parameter, | ||
whitespaceAfter: true | ||
}, | ||
{ | ||
text: 'c:', | ||
position: c.position, | ||
kind: ts.InlayHintKind.Parameter, | ||
whitespaceAfter: true | ||
}, | ||
], undefined, { | ||
includeInlayParameterNameHints: "all" | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/// <reference path="fourslash.ts" /> | ||
|
||
////function foo({ a, b }: { a: unknown, b: unknown }, c: unknown, d: unknown) { } | ||
////function bar(...x: [{ a: unknown, b: unknown }, number]) { | ||
//// foo(...x, /*d*/1); | ||
////} | ||
|
||
const [d] = test.markers(); | ||
|
||
verify.getInlayHints([ | ||
{ | ||
text: 'd:', | ||
position: d.position, | ||
kind: ts.InlayHintKind.Parameter, | ||
whitespaceAfter: true | ||
}, | ||
], undefined, { | ||
includeInlayParameterNameHints: "all" | ||
}); |