Use baselines for inlay hints testing (#54844)

This commit is contained in:
Maria José Solano authored and GitHub committed 2023-07-05 12:08:56 -07:00
1 parent 07e6962a58
commit 89f6ef9d78
155 files changed
+1523 -1096

No files matched your search

+18 -10
View File
@@ -822,21 +822,29 @@ export class TestState {
});
}
public verifyInlayHints(expected: readonly FourSlashInterface.VerifyInlayHintsOptions[], span: ts.TextSpan = { start: 0, length: this.activeFile.content.length }, preference?: ts.UserPreferences) {
const hints = this.languageService.provideInlayHints(this.activeFile.fileName, span, preference);
assert.equal(hints.length, expected.length, "Number of hints");
public baselineInlayHints(span: ts.TextSpan = { start: 0, length: this.activeFile.content.length }, preferences?: ts.UserPreferences): void{
interface HasPosition { position: number; }
const sortHints = (a: HasPosition, b: HasPosition) => {
return a.position - b.position;
};
ts.zipWith(hints.sort(sortHints), [...expected].sort(sortHints), (actual, expected) => {
assert.equal(actual.text, expected.text, "Text");
assert.equal(actual.position, expected.position, "Position");
assert.equal(actual.kind, expected.kind, "Kind");
assert.equal(actual.whitespaceBefore, expected.whitespaceBefore, "whitespaceBefore");
assert.equal(actual.whitespaceAfter, expected.whitespaceAfter, "whitespaceAfter");
const baselineFile = this.getBaselineFileNameForContainingTestFile();
const fileName = this.activeFile.fileName;
const hints = this.languageService.provideInlayHints(fileName, span, preferences);
const annotations = ts.map(hints.sort(sortHints), hint => {
const span = { start: hint.position, length: hint.text.length };
const { character, line } = this.languageServiceAdapterHost.positionToLineAndCharacter(fileName, span.start);
const underline = " ".repeat(character) + "^";
let annotation = this.getFileContent(fileName).split(/\r?\n/)[line];
annotation += "\n" + underline + "\n" + JSON.stringify(hint, undefined, " ");
return annotation;
});
if (annotations.length === 0) {
annotations.push("=== No inlay hints ===");
}
Harness.Baseline.runBaseline(baselineFile, annotations.join("\n\n"));
}
public verifyCompletions(options: FourSlashInterface.VerifyCompletionsOptions) {
+3 -3
View File
@@ -261,8 +261,8 @@ export class Verify extends VerifyNegatable {
};
}
public getInlayHints(expected: readonly VerifyInlayHintsOptions[], span: ts.TextSpan, preference?: ts.UserPreferences) {
this.state.verifyInlayHints(expected, span, preference);
public baselineInlayHints(span: ts.TextSpan, preference?: ts.UserPreferences) {
this.state.baselineInlayHints(span, preference);
}
public quickInfoIs(expectedText: string, expectedDocumentation?: string, expectedTags?: { name: string; text: string; }[]) {
@@ -1952,4 +1952,4 @@ export type BaselineCommand = BaselineCommandWithMarkerOrRange | {
} | {
type: "customWork";
work: () => string | undefined;
};
};
@@ -0,0 +1 @@
=== No inlay hints ===
@@ -0,0 +1,17 @@
foo(1, 2);
^
{
"text": "a:",
"position": 43,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(1, 2);
^
{
"text": "b:",
"position": 46,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1 @@
=== No inlay hints ===
@@ -0,0 +1,17 @@
foo(1)(2);
^
{
"text": "a:",
"position": 87,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(1)(2);
^
{
"text": "b:",
"position": 90,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,17 @@
return a(1) + 2
^
{
"text": "b:",
"position": 54,
"kind": "Parameter",
"whitespaceAfter": true
}
foo((c: number) => c + 1);
^
{
"text": "a:",
"position": 67,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,8 @@
foo(a, 2);
^
{
"text": "b:",
"position": 66,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1 @@
=== No inlay hints ===
@@ -0,0 +1 @@
=== No inlay hints ===
@@ -0,0 +1 @@
=== No inlay hints ===
@@ -0,0 +1 @@
=== No inlay hints ===
@@ -0,0 +1,8 @@
const a = () => 123;
^
{
"text": ": () => number",
"position": 7,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1,8 @@
foo(1, { c: 1});
^
{
"text": "a:",
"position": 44,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1 @@
=== No inlay hints ===
@@ -0,0 +1 @@
=== No inlay hints ===
@@ -0,0 +1 @@
=== No inlay hints ===
@@ -0,0 +1,8 @@
foo(1);
^
{
"text": "Im_very_very_very_very_very...:",
"position": 73,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,17 @@
const f: F = (a, b) => { }
^
{
"text": ": string",
"position": 55,
"kind": "Type",
"whitespaceBefore": true
}
const f: F = (a, b) => { }
^
{
"text": ": number",
"position": 58,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1,8 @@
foo((a) => { })
^
{
"text": ": string",
"position": 48,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1,8 @@
foo((a) => { })
^
{
"text": ": 2 | 3",
"position": 63,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1,17 @@
foo(a => {
^
{
"text": ": (c: (d: 2 | 3) => void) => ...",
"position": 87,
"kind": "Type",
"whitespaceBefore": true
}
a(d => {})
^
{
"text": ": 2 | 3",
"position": 100,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1,8 @@
const f: F = (a, b: number) => { }
^
{
"text": ": string",
"position": 55,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1,35 @@
foo(a => {
^
{
"text": "a:",
"position": 86,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(a => {
^
{
"text": ": (c: (d: 2 | 3) => void) => ...",
"position": 87,
"kind": "Type",
"whitespaceBefore": true
}
a(d => {})
^
{
"text": "c:",
"position": 99,
"kind": "Parameter",
"whitespaceAfter": true
}
a(d => {})
^
{
"text": ": 2 | 3",
"position": 100,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1,17 @@
foo(1, 1, 1, 1);
^
{
"text": "a:",
"position": 48,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(1, 1, 1, 1);
^
{
"text": "...b:",
"position": 51,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,8 @@
f(1, a => { })
^
{
"text": ": number",
"position": 48,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1,8 @@
const f: F = (a) => { }
^
{
"text": ": { a: number; b: string; }",
"position": 69,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1,53 @@
function c2 () { foo2(1, 2); }
^
{
"text": "c:",
"position": 293,
"kind": "Parameter",
"whitespaceAfter": true
}
function c2 () { foo2(1, 2); }
^
{
"text": "d:",
"position": 296,
"kind": "Parameter",
"whitespaceAfter": true
}
function c3 () { foo3(1, 2); }
^
{
"text": "e:",
"position": 324,
"kind": "Parameter",
"whitespaceAfter": true
}
function c3 () { foo3(1, 2); }
^
{
"text": "f:",
"position": 327,
"kind": "Parameter",
"whitespaceAfter": true
}
function c4 () { foo4(1, 2); }
^
{
"text": "g:",
"position": 355,
"kind": "Parameter",
"whitespaceAfter": true
}
function c4 () { foo4(1, 2); }
^
{
"text": "h:",
"position": 358,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,53 @@
foo2(1, 2);
^
{
"text": "c:",
"position": 257,
"kind": "Parameter",
"whitespaceAfter": true
}
foo2(1, 2);
^
{
"text": "d:",
"position": 260,
"kind": "Parameter",
"whitespaceAfter": true
}
foo3(1, 2);
^
{
"text": "e:",
"position": 269,
"kind": "Parameter",
"whitespaceAfter": true
}
foo3(1, 2);
^
{
"text": "f:",
"position": 272,
"kind": "Parameter",
"whitespaceAfter": true
}
foo4(1, 2);
^
{
"text": "g:",
"position": 281,
"kind": "Parameter",
"whitespaceAfter": true
}
foo4(1, 2);
^
{
"text": "h:",
"position": 284,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,44 @@
foo(1);
^
{
"text": "v:",
"position": 29,
"kind": "Parameter",
"whitespaceAfter": true
}
foo('');
^
{
"text": "v:",
"position": 37,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(true);
^
{
"text": "v:",
"position": 46,
"kind": "Parameter",
"whitespaceAfter": true
}
foo((1));
^
{
"text": "v:",
"position": 67,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(foo(1));
^
{
"text": "v:",
"position": 81,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,116 @@
foo(1);
^
{
"text": "v:",
"position": 29,
"kind": "Parameter",
"whitespaceAfter": true
}
foo('');
^
{
"text": "v:",
"position": 37,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(true);
^
{
"text": "v:",
"position": 46,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(() => 1);
^
{
"text": "v:",
"position": 57,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(function () { return 1 });
^
{
"text": "v:",
"position": 71,
"kind": "Parameter",
"whitespaceAfter": true
}
foo({});
^
{
"text": "v:",
"position": 102,
"kind": "Parameter",
"whitespaceAfter": true
}
foo({ a: 1 });
^
{
"text": "v:",
"position": 111,
"kind": "Parameter",
"whitespaceAfter": true
}
foo([]);
^
{
"text": "v:",
"position": 126,
"kind": "Parameter",
"whitespaceAfter": true
}
foo([1]);
^
{
"text": "v:",
"position": 135,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(foo);
^
{
"text": "v:",
"position": 145,
"kind": "Parameter",
"whitespaceAfter": true
}
foo((1));
^
{
"text": "v:",
"position": 155,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(foo(1));
^
{
"text": "v:",
"position": 165,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(foo(1));
^
{
"text": "v:",
"position": 169,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,17 @@
foo(a, 2);
^
{
"text": "a:",
"position": 63,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(a, 2);
^
{
"text": "b:",
"position": 66,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,8 @@
a = 1
^
{
"text": ": number",
"position": 15,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1,8 @@
function foo () {
^
{
"text": ": number",
"position": 15,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1 @@
=== No inlay hints ===
@@ -0,0 +1,26 @@
foo(1)
^
{
"text": "w:",
"position": 166,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(1, 2)
^
{
"text": "a:",
"position": 173,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(1, 2)
^
{
"text": "b:",
"position": 176,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,8 @@
foo() {
^
{
"text": ": number",
"position": 19,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1,8 @@
const a = () => 1
^
{
"text": ": number",
"position": 12,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1,8 @@
const a = function () { return 1}
^
{
"text": ": number",
"position": 21,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1,8 @@
const a = (b) => 1
^
{
"text": ": number",
"position": 13,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1,26 @@
A,
^
{
"text": "= 0",
"position": 14,
"kind": "Enum",
"whitespaceBefore": true
}
AA,
^
{
"text": "= 1",
"position": 22,
"kind": "Enum",
"whitespaceBefore": true
}
BB,
^
{
"text": "= 11",
"position": 42,
"kind": "Enum",
"whitespaceBefore": true
}
@@ -0,0 +1 @@
=== No inlay hints ===
@@ -0,0 +1,17 @@
function bar () { return require('./a').a; }
^
{
"text": ": 1",
"position": 58,
"kind": "Type",
"whitespaceBefore": true
}
const d = bar()
^
{
"text": ": 1",
"position": 111,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1,17 @@
y.foo(1, 2)
^
{
"text": "a:",
"position": 88,
"kind": "Parameter",
"whitespaceAfter": true
}
y.foo(1, 2)
^
{
"text": "b:",
"position": 91,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,8 @@
const x = foo(1)
^
{
"text": ": 1",
"position": 55,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1 @@
=== No inlay hints ===
@@ -0,0 +1,26 @@
foo(1, 2, 3)
^
{
"text": "c:",
"position": 87,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(1, 2, 3)
^
{
"text": "a:",
"position": 90,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(1, 2, 3)
^
{
"text": "b:",
"position": 93,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,53 @@
foo(1, '', false, 1, 2)
^
{
"text": "f:",
"position": 161,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(1, '', false, 1, 2)
^
{
"text": "a:",
"position": 164,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(1, '', false, 1, 2)
^
{
"text": "b:",
"position": 168,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(1, '', false, 1, 2)
^
{
"text": "...c:",
"position": 175,
"kind": "Parameter",
"whitespaceAfter": true
}
foo1(1, "", "")
^
{
"text": "f1:",
"position": 186,
"kind": "Parameter",
"whitespaceAfter": true
}
foo1(1, "", "")
^
{
"text": "...args:",
"position": 189,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,35 @@
async function foo () {
^
{
"text": ": Promise<Foo>",
"position": 21,
"kind": "Type",
"whitespaceBefore": true
}
function bar () { return import('./a') }
^
{
"text": ": Promise<typeof import(\"/a\")>",
"position": 83,
"kind": "Type",
"whitespaceBefore": true
}
async function main () {
^
{
"text": ": Promise<void>",
"position": 131,
"kind": "Type",
"whitespaceBefore": true
}
const a = await foo()
^
{
"text": ": Foo",
"position": 145,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1,53 @@
function foo (aParameter: number, bParameter: number, cParameter: number) { }
^
{
"text": ": void",
"position": 73,
"kind": "Type",
"whitespaceBefore": true
}
2,
^
{
"text": "bParameter:",
"position": 134,
"kind": "Parameter",
"whitespaceAfter": true
}
3
^
{
"text": "cParameter:",
"position": 338,
"kind": "Parameter",
"whitespaceAfter": true
}
1,
^
{
"text": "aParameter:",
"position": 373,
"kind": "Parameter",
"whitespaceAfter": true
}
2,
^
{
"text": "bParameter:",
"position": 380,
"kind": "Parameter",
"whitespaceAfter": true
}
3
^
{
"text": "cParameter:",
"position": 440,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,8 @@
fn(/* nobody knows exactly what this param is */ 42);
^
{
"text": "x:",
"position": 76,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,44 @@
foo(a, 2);
^
{
"text": "b:",
"position": 66,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(v.a, v.a);
^
{
"text": "b:",
"position": 101,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(v.b, v.b);
^
{
"text": "a:",
"position": 111,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(v.c, v.c);
^
{
"text": "a:",
"position": 126,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(v.c, v.c);
^
{
"text": "b:",
"position": 131,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,8 @@
get foo() { return 1; }
^
{
"text": ": number",
"position": 25,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1,26 @@
const array = [1, 2]
^
{
"text": ": number[]",
"position": 45,
"kind": "Type",
"whitespaceBefore": true
}
const a = object;
^
{
"text": ": { foo: number; bar: number; }",
"position": 62,
"kind": "Type",
"whitespaceBefore": true
}
const b = array;
^
{
"text": ": number[]",
"position": 128,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1,8 @@
set foo(value) { this.#value = value; }
^
{
"text": ": number",
"position": 91,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1 @@
=== No inlay hints ===
@@ -0,0 +1 @@
=== No inlay hints ===
@@ -0,0 +1,8 @@
foo(1, 2, 3)
^
{
"text": "c:",
"position": 81,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,8 @@
set foo(value) { this.#value = value; }
^
{
"text": ": number",
"position": 83,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1 @@
=== No inlay hints ===
@@ -0,0 +1,17 @@
trace(`${1}`);
^
{
"text": "message:",
"position": 41,
"kind": "Parameter",
"whitespaceAfter": true
}
trace(``);
^
{
"text": "message:",
"position": 56,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,35 @@
foo(1, +1, -1, +"1");
^
{
"text": "a:",
"position": 64,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(1, +1, -1, +"1");
^
{
"text": "b:",
"position": 67,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(1, +1, -1, +"1");
^
{
"text": "c:",
"position": 71,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(1, +1, -1, +"1");
^
{
"text": "d:",
"position": 75,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,89 @@
"hello",
^
{
"text": "a:",
"position": 183,
"kind": "Parameter",
"whitespaceAfter": true
}
undefined,
^
{
"text": "b:",
"position": 196,
"kind": "Parameter",
"whitespaceAfter": true
}
null,
^
{
"text": "c:",
"position": 211,
"kind": "Parameter",
"whitespaceAfter": true
}
true,
^
{
"text": "d:",
"position": 221,
"kind": "Parameter",
"whitespaceAfter": true
}
false,
^
{
"text": "e:",
"position": 231,
"kind": "Parameter",
"whitespaceAfter": true
}
Infinity,
^
{
"text": "f:",
"position": 242,
"kind": "Parameter",
"whitespaceAfter": true
}
-Infinity,
^
{
"text": "g:",
"position": 256,
"kind": "Parameter",
"whitespaceAfter": true
}
NaN,
^
{
"text": "h:",
"position": 271,
"kind": "Parameter",
"whitespaceAfter": true
}
/hello/g,
^
{
"text": "i:",
"position": 280,
"kind": "Parameter",
"whitespaceAfter": true
}
123n,
^
{
"text": "j:",
"position": 294,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,8 @@
const f: F = (a, b = 1) => { }
^
{
"text": ": string",
"position": 55,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1,8 @@
bar: function (x?): void {
^
{
"text": ": boolean",
"position": 87,
"kind": "Type",
"whitespaceBefore": true
}
@@ -0,0 +1 @@
=== No inlay hints ===
@@ -0,0 +1,17 @@
const C1 = class extends foo(1) { }
^
{
"text": "a:",
"position": 63,
"kind": "Parameter",
"whitespaceAfter": true
}
class C2 extends foo(1) { }
^
{
"text": "a:",
"position": 91,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1 @@
=== No inlay hints ===
@@ -0,0 +1,26 @@
call(1);
^
{
"text": "a:",
"position": 105,
"kind": "Parameter",
"whitespaceAfter": true
}
call(1, 2);
^
{
"text": "b:",
"position": 114,
"kind": "Parameter",
"whitespaceAfter": true
}
call(1, 2);
^
{
"text": "c:",
"position": 117,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,17 @@
foo(...x, 3);
^
{
"text": "a:",
"position": 100,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(...x, 3);
^
{
"text": "c:",
"position": 106,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,17 @@
foo(...x, 3);
^
{
"text": "a:",
"position": 120,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(...x, 3);
^
{
"text": "d:",
"position": 126,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,17 @@
foo(...x, 3);
^
{
"text": "a:",
"position": 101,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(...x, 3);
^
{
"text": "b:",
"position": 107,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,17 @@
foo(1, ...x);
^
{
"text": "a:",
"position": 101,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(1, ...x);
^
{
"text": "b:",
"position": 104,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,17 @@
foo(...x, 3);
^
{
"text": "a:",
"position": 112,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(...x, 3);
^
{
"text": "c:",
"position": 118,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,26 @@
foo(...x, 1, 2, 3);
^
{
"text": "a:",
"position": 92,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(...x, 1, 2, 3);
^
{
"text": "b:",
"position": 95,
"kind": "Parameter",
"whitespaceAfter": true
}
foo(...x, 1, 2, 3);
^
{
"text": "c:",
"position": 98,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,8 @@
foo(...x, 1);
^
{
"text": "d:",
"position": 152,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,26 @@
new Class(1)
^
{
"text": "a:",
"position": 136,
"kind": "Parameter",
"whitespaceAfter": true
}
new Class(1, 2)
^
{
"text": "b:",
"position": 149,
"kind": "Parameter",
"whitespaceAfter": true
}
new Class(1, 2)
^
{
"text": "c:",
"position": 152,
"kind": "Parameter",
"whitespaceAfter": true
}
@@ -0,0 +1,35 @@
call(1);
^
{
"text": "a:",
"position": 131,
"kind": "Parameter",
"whitespaceAfter": true
}
call(1, 2);
^
{
"text": "b:",
"position": 140,
"kind": "Parameter",
"whitespaceAfter": true
}
call(1, 2);
^
{
"text": "c:",
"position": 143,
"kind": "Parameter",
"whitespaceAfter": true
}
new call(1);
^
{
"text": "d:",
"position": 156,
"kind": "Parameter",
"whitespaceAfter": true
}
+1 -4
View File
@@ -415,10 +415,7 @@ declare namespace FourSlashInterface {
start: number;
length: number;
}, displayParts: ts.SymbolDisplayPart[], documentation: ts.SymbolDisplayPart[], tags: { name: string, text?: string }[] | undefined): void;
getInlayHints(expected: readonly VerifyInlayHintsOptions[], textSpan?: {
start: number;
length: number;
}, preference?: InlayHintsOptions);
baselineInlayHints(span?: { start: number; length: number; }, preferences?: InlayHintsOptions): void;
getSyntacticDiagnostics(expected: ReadonlyArray<Diagnostic>): void;
getSemanticDiagnostics(expected: ReadonlyArray<Diagnostic>): void;
getSuggestionDiagnostics(expected: ReadonlyArray<Diagnostic>): void;
+3 -1
View File
@@ -1,4 +1,5 @@
/// <reference path="fourslash.ts" />
// @allowJs: true
// @checkJs: true
// @Filename: foo.js
@@ -8,7 +9,8 @@
//// function doThing(f) {
//// f(100)
//// }
verify.getInlayHints([], undefined, {
verify.baselineInlayHints(undefined, {
includeInlayVariableTypeHints: true,
includeInlayParameterNameHints: "all",
});
+2 -18
View File
@@ -1,22 +1,6 @@
/// <reference path="fourslash.ts" />
//// function foo (a: number, b: number) {}
//// foo(/*a*/1, /*b*/2);
//// foo(1, 2);
const markers = test.markers();
verify.getInlayHints([
{
text: 'a:',
position: markers[0].position,
kind: ts.InlayHintKind.Parameter,
whitespaceAfter: true
},
{
text: 'b:',
position: markers[1].position,
kind: ts.InlayHintKind.Parameter,
whitespaceAfter: true
}
], undefined, {
includeInlayParameterNameHints: "literals"
});
verify.baselineInlayHints(undefined, { includeInlayParameterNameHints: "literals" });
@@ -3,6 +3,6 @@
//// declare const unknownCall: any;
//// unknownCall();
verify.getInlayHints([], undefined, {
verify.baselineInlayHints(undefined, {
includeInlayParameterNameHints: "literals"
});
@@ -5,22 +5,8 @@
//// return a + b
//// }
//// }
//// foo(/*a*/1)(/*b*/2);
//// foo(1)(2);
const markers = test.markers();
verify.getInlayHints([
{
text: 'a:',
position: markers[0].position,
kind: ts.InlayHintKind.Parameter,
whitespaceAfter: true
},
{
text: 'b:',
position: markers[1].position,
kind: ts.InlayHintKind.Parameter,
whitespaceAfter: true
},
], undefined, {
verify.baselineInlayHints(undefined, {
includeInlayParameterNameHints: "literals"
});
@@ -1,25 +1,11 @@
/// <reference path="fourslash.ts" />
//// function foo(a: (b: number) => number) {
//// return a(/*a*/1) + 2
//// return a(1) + 2
//// }
//// foo(/*b*/(c: number) => c + 1);
//// foo((c: number) => c + 1);
const markers = test.markers();
verify.getInlayHints([
{
text: 'b:',
position: markers[0].position,
kind: ts.InlayHintKind.Parameter,
whitespaceAfter: true
},
{
text: 'a:',
position: markers[1].position,
kind: ts.InlayHintKind.Parameter,
whitespaceAfter: true
},
], undefined, {
verify.baselineInlayHints(undefined, {
includeInlayParameterNameHints: "all"
});
@@ -2,17 +2,9 @@
//// function foo (a: number, b: number) {}
//// declare const a: 1;
//// foo(a, /*b*/2);
//// foo(a, 2);
const markers = test.markers();
verify.getInlayHints([
{
text: 'b:',
position: markers[0].position,
kind: ts.InlayHintKind.Parameter,
whitespaceAfter: true
},
], undefined, {
verify.baselineInlayHints(undefined, {
includeInlayParameterNameHints: "all",
includeInlayParameterNameHintsWhenArgumentMatchesName: false,
});
@@ -3,6 +3,6 @@
//// function foo (a: number, b: number) {}
//// foo(1, 2);
verify.getInlayHints([], undefined, {
verify.baselineInlayHints(undefined, {
includeInlayParameterNameHints: "none"
});
@@ -20,6 +20,6 @@
////const k = { a: 1, b: 1 };
////const l = ((({ a: 1, b: 1 })));
verify.getInlayHints([], undefined, {
verify.baselineInlayHints(undefined, {
includeInlayVariableTypeHints: true
});
@@ -2,6 +2,6 @@
//// const a = { a: 123 };
verify.getInlayHints([], undefined, {
verify.baselineInlayHints(undefined, {
includeInlayVariableTypeHints: true
});
@@ -3,6 +3,6 @@
//// class Class {}
//// const a = new Class();
verify.getInlayHints([], undefined, {
verify.baselineInlayHints(undefined, {
includeInlayVariableTypeHints: true
});
@@ -1,15 +1,7 @@
/// <reference path="fourslash.ts" />
//// const a/*a*/ = () => 123;
//// const a = () => 123;
const markers = test.markers();
verify.getInlayHints([
{
text: ': () => number',
position: markers[0].position,
kind: ts.InlayHintKind.Type,
whitespaceBefore: true
},
], undefined, {
verify.baselineInlayHints(undefined, {
includeInlayVariableTypeHints: true
});
+2 -10
View File
@@ -1,16 +1,8 @@
/// <reference path="fourslash.ts" />
//// function foo (a: number, { c }: any) {}
//// foo(/*a*/1, { c: 1});
//// foo(1, { c: 1});
const markers = test.markers();
verify.getInlayHints([
{
text: 'a:',
position: markers[0].position,
kind: ts.InlayHintKind.Parameter,
whitespaceAfter: true
}
], undefined, {
verify.baselineInlayHints(undefined, {
includeInlayParameterNameHints: "literals"
});
@@ -2,6 +2,6 @@
//// const a = 123;
verify.getInlayHints([], undefined, {
verify.baselineInlayHints(undefined, {
includeInlayVariableTypeHints: false
});
@@ -2,6 +2,6 @@
//// const a;
verify.getInlayHints([], undefined, {
verify.baselineInlayHints(undefined, {
includeInlayVariableTypeHints: true
});
@@ -2,6 +2,6 @@
////const a = "I'm very very very very very very very very very long";
verify.getInlayHints([], undefined, {
verify.baselineInlayHints(undefined, {
includeInlayVariableTypeHints: true
});
@@ -1,16 +1,8 @@
/// <reference path="fourslash.ts" />
//// function foo (Im_very_very_very_very_very_very_very_long: number) {}
//// foo(/*a*/1);
//// foo(1);
const markers = test.markers();
verify.getInlayHints([
{
text: 'Im_very_very_very_very_very...:',
position: markers[0].position,
kind: ts.InlayHintKind.Parameter,
whitespaceAfter: true
}
], undefined, {
verify.baselineInlayHints(undefined, {
includeInlayParameterNameHints: "literals"
});
@@ -1,22 +1,8 @@
/// <reference path="fourslash.ts" />
//// type F = (a: string, b: number) => void
//// const f: F = (a/*a*/, b/*b*/) => { }
//// const f: F = (a, b) => { }
const markers = test.markers();
verify.getInlayHints([
{
text: ': string',
position: markers[0].position,
kind: ts.InlayHintKind.Type,
whitespaceBefore: true
},
{
text: ': number',
position: markers[1].position,
kind: ts.InlayHintKind.Type,
whitespaceBefore: true
}
], undefined, {
verify.baselineInlayHints(undefined, {
includeInlayFunctionParameterTypeHints: true
});
@@ -1,16 +1,8 @@
/// <reference path="fourslash.ts" />
//// function foo (cb: (a: string) => void) {}
//// foo((a/*a*/) => { })
//// foo((a) => { })
const markers = test.markers();
verify.getInlayHints([
{
text: ': string',
position: markers[0].position,
kind: ts.InlayHintKind.Type,
whitespaceBefore: true
}
], undefined, {
verify.baselineInlayHints(undefined, {
includeInlayFunctionParameterTypeHints: true
});
@@ -1,16 +1,8 @@
/// <reference path="fourslash.ts" />
//// function foo (cb: (a: Exclude<1 | 2 | 3, 1>) => void) {}
//// foo((a/*a*/) => { })
//// foo((a) => { })
const markers = test.markers();
verify.getInlayHints([
{
text: ': 2 | 3',
position: markers[0].position,
kind: ts.InlayHintKind.Type,
whitespaceBefore: true
}
], undefined, {
verify.baselineInlayHints(undefined, {
includeInlayFunctionParameterTypeHints: true
});
@@ -1,24 +1,10 @@
/// <reference path="fourslash.ts" />
//// function foo (a: (b: (c: (d: Exclude<1 | 2 | 3, 1>) => void) => void) => void) {}
//// foo(a/*a*/ => {
//// a(d/*b*/ => {})
//// foo(a => {
//// a(d => {})
//// })
const markers = test.markers();
verify.getInlayHints([
{
text: ': (c: (d: 2 | 3) => void) => ...',
position: markers[0].position,
kind: ts.InlayHintKind.Type,
whitespaceBefore: true
},
{
text: ': 2 | 3',
position: markers[1].position,
kind: ts.InlayHintKind.Type,
whitespaceBefore: true
}
], undefined, {
verify.baselineInlayHints(undefined, {
includeInlayFunctionParameterTypeHints: true
});
@@ -1,16 +1,8 @@
/// <reference path="fourslash.ts" />
//// type F = (a: string, b: number) => void
//// const f: F = (a/*a*/, b: number) => { }
//// const f: F = (a, b: number) => { }
const markers = test.markers();
verify.getInlayHints([
{
text: ': string',
position: markers[0].position,
kind: ts.InlayHintKind.Type,
whitespaceBefore: true
}
], undefined, {
verify.baselineInlayHints(undefined, {
includeInlayFunctionParameterTypeHints: true
});
Loaded 100 of 155 files, more files were not shown because too many files have changed in this diff. Show more