From 8812beb0667989a8eca727abcad1b86e1032258a Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 2 May 2018 15:20:52 -0700 Subject: [PATCH] Implement feedback on "Improve completions testing" --- src/harness/fourslash.ts | 57 ++++++++++--------- tests/cases/fourslash/augmentedTypesClass1.ts | 4 +- .../cases/fourslash/augmentedTypesModule6.ts | 8 +-- tests/cases/fourslash/cloduleAsBaseClass2.ts | 4 +- tests/cases/fourslash/cloduleTypeOf1.ts | 6 +- tests/cases/fourslash/commentsEnums.ts | 6 +- .../fourslash/commentsImportDeclaration.ts | 10 ++-- tests/cases/fourslash/commentsVariables.ts | 12 ++-- ...tionForStringLiteralNonrelativeImport10.ts | 2 +- ...tionForStringLiteralNonrelativeImport11.ts | 8 +-- ...tionForStringLiteralNonrelativeImport12.ts | 4 +- ...etionForStringLiteralNonrelativeImport4.ts | 4 +- ...etionForStringLiteralNonrelativeImport5.ts | 8 +-- ...etionForStringLiteralNonrelativeImport7.ts | 4 +- ...etionForStringLiteralNonrelativeImport8.ts | 4 +- ...etionForStringLiteralNonrelativeImport9.ts | 2 +- ...mpletionForStringLiteralRelativeImport3.ts | 8 +-- ...mpletionForStringLiteralRelativeImport4.ts | 4 +- .../completionListInUnclosedFunction01.ts | 2 +- .../completionListInUnclosedFunction02.ts | 2 +- .../completionListInUnclosedFunction03.ts | 2 +- .../completionListInUnclosedFunction04.ts | 2 +- .../completionListInUnclosedFunction05.ts | 2 +- .../completionListInUnclosedFunction06.ts | 2 +- .../completionListInUnclosedFunction07.ts | 2 +- .../completionListInUnclosedFunction08.ts | 2 +- .../completionListInUnclosedFunction09.ts | 2 +- .../completionListInUnclosedFunction10.ts | 2 +- .../completionListInUnclosedFunction11.ts | 2 +- .../completionListInUnclosedFunction12.ts | 2 +- .../completionListInUnclosedFunction13.ts | 2 +- .../completionListInUnclosedFunction14.ts | 2 +- .../completionListInUnclosedFunction15.ts | 2 +- .../completionListInUnclosedFunction16.ts | 2 +- .../completionListInUnclosedFunction17.ts | 2 +- .../completionListInUnclosedFunction18.ts | 2 +- .../completionListInUnclosedFunction19.ts | 2 +- ...nUnclosedObjectTypeLiteralInSignature02.ts | 2 +- .../completionListProtectedMembers.ts | 10 ++-- .../completionListStaticProtectedMembers.ts | 4 +- .../fourslash/completionListSuperMembers.ts | 2 +- .../completionListWithAmbientDeclaration.ts | 4 +- ...completionsImport_compilerOptionsModule.ts | 4 +- .../completionsImport_defaultFalsePositive.ts | 2 +- .../completionsImport_default_anonymous.ts | 4 +- .../fourslash/completionsImport_matching.ts | 2 +- ...mpletionsImport_named_didNotExistBefore.ts | 2 +- ...tionsImport_notFromUnrelatedNodeModules.ts | 2 +- .../fourslash/completionsImport_ofAlias.ts | 2 +- ...mpletionsImport_ofAlias_preferShortPath.ts | 2 +- .../completionsImport_shadowedByLocal.ts | 2 +- .../cases/fourslash/completionsPaths_kinds.ts | 4 +- .../fourslash/completionsTriggerCharacter.ts | 20 +++---- .../distinctTypesInCallbacksWithSameNames.ts | 4 +- .../fourslash/extendArrayInterfaceMember.ts | 2 +- tests/cases/fourslash/fourslash.ts | 30 +++++----- .../fourslash/getJavaScriptCompletions12.ts | 6 +- .../fourslash/getJavaScriptCompletions13.ts | 4 +- tests/cases/fourslash/javaScriptClass1.ts | 2 +- tests/cases/fourslash/javaScriptModules12.ts | 6 +- .../memberCompletionOnTypeParameters.ts | 6 +- .../memberListInsideObjectLiterals.ts | 4 +- ...hRefPathCompletionExtensionsAllowJSTrue.ts | 2 +- tests/cases/fourslash/tsxCompletion14.ts | 4 +- tests/cases/fourslash/tsxCompletion8.ts | 2 +- .../fourslash/tsxCompletionNonTagLessThan.ts | 2 +- .../fourslash/tsxCompletionOnClosingTag2.ts | 2 +- .../tsxCompletionOnClosingTagWithoutJSX2.ts | 2 +- 68 files changed, 171 insertions(+), 168 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 5e932050bfd7f..85c4174249a00 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -22,7 +22,7 @@ namespace FourSlash { ts.disableIncrementalParsing = false; - import Many = FourSlashInterface.Many; + import ArrayOrSingle = FourSlashInterface.Many; // Represents a parsed source file with metadata interface FourSlashFile { @@ -617,11 +617,11 @@ namespace FourSlash { } } - public verifyGoToDefinitionIs(endMarker: Many) { + public verifyGoToDefinitionIs(endMarker: ArrayOrSingle) { this.verifyGoToXWorker(toArray(endMarker), () => this.getGoToDefinition()); } - public verifyGoToDefinition(arg0: any, endMarkerNames?: Many) { + public verifyGoToDefinition(arg0: any, endMarkerNames?: ArrayOrSingle) { this.verifyGoToX(arg0, endMarkerNames, () => this.getGoToDefinitionAndBoundSpan()); } @@ -633,23 +633,23 @@ namespace FourSlash { return this.languageService.getDefinitionAndBoundSpan(this.activeFile.fileName, this.currentCaretPosition); } - public verifyGoToType(arg0: any, endMarkerNames?: Many) { + public verifyGoToType(arg0: any, endMarkerNames?: ArrayOrSingle) { this.verifyGoToX(arg0, endMarkerNames, () => this.languageService.getTypeDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition)); } - private verifyGoToX(arg0: any, endMarkerNames: Many | undefined, getDefs: () => ts.DefinitionInfo[] | ts.DefinitionInfoAndBoundSpan | undefined) { + private verifyGoToX(arg0: any, endMarkerNames: ArrayOrSingle | undefined, getDefs: () => ts.DefinitionInfo[] | ts.DefinitionInfoAndBoundSpan | undefined) { if (endMarkerNames) { this.verifyGoToXPlain(arg0, endMarkerNames, getDefs); } else if (ts.isArray(arg0)) { - const pairs = arg0 as ReadonlyArray<[Many, Many]>; + const pairs = arg0 as ReadonlyArray<[ArrayOrSingle, ArrayOrSingle]>; for (const [start, end] of pairs) { this.verifyGoToXPlain(start, end, getDefs); } } else { - const obj: { [startMarkerName: string]: Many } = arg0; + const obj: { [startMarkerName: string]: ArrayOrSingle } = arg0; for (const startMarkerName in obj) { if (ts.hasProperty(obj, startMarkerName)) { this.verifyGoToXPlain(startMarkerName, obj[startMarkerName], getDefs); @@ -658,7 +658,7 @@ namespace FourSlash { } } - private verifyGoToXPlain(startMarkerNames: Many, endMarkerNames: Many, getDefs: () => ts.DefinitionInfo[] | ts.DefinitionInfoAndBoundSpan | undefined) { + private verifyGoToXPlain(startMarkerNames: ArrayOrSingle, endMarkerNames: ArrayOrSingle, getDefs: () => ts.DefinitionInfo[] | ts.DefinitionInfoAndBoundSpan | undefined) { for (const start of toArray(startMarkerNames)) { this.verifyGoToXSingle(start, endMarkerNames, getDefs); } @@ -670,7 +670,7 @@ namespace FourSlash { } } - private verifyGoToXSingle(startMarkerName: string, endMarkerNames: Many, getDefs: () => ReadonlyArray | ts.DefinitionInfoAndBoundSpan | undefined) { + private verifyGoToXSingle(startMarkerName: string, endMarkerNames: ArrayOrSingle, getDefs: () => ReadonlyArray | ts.DefinitionInfoAndBoundSpan | undefined) { this.goToMarker(startMarkerName); this.verifyGoToXWorker(toArray(endMarkerNames), getDefs, startMarkerName); } @@ -833,19 +833,21 @@ namespace FourSlash { } public verifyCompletions(options: FourSlashInterface.VerifyCompletionsOptions) { - if (options.at !== undefined) { - if (typeof options.at === "string") { - this.goToMarker(options.at); - } - else { - for (const a of options.at) this.verifyCompletions({ ...options, at: a }); - return; + if (options.marker === undefined) { + this.verifyCompletionsWorker(options); + } + else { + for (const marker of toArray(options.marker)) { + this.goToMarker(marker); + this.verifyCompletionsWorker(options); } } + } + private verifyCompletionsWorker(options: FourSlashInterface.VerifyCompletionsOptions): void { const actualCompletions = this.getCompletionListAtCaret({ ...options.preferences, triggerCharacter: options.triggerCharacter }); if (!actualCompletions) { - if (options.are === undefined) return; + if (options.exact === undefined) return; this.raiseError(`No completions at position '${this.currentCaretPosition}'.`); } @@ -864,9 +866,10 @@ namespace FourSlash { } } - if ("are" in options) { - if (options.are === undefined) this.raiseError("Expected no completions"); - this.verifyCompletionsAreExactly(actualCompletions.entries, toArray(options.are)); + if ("exact" in options) { + ts.Debug.assert(!("includes" in options) && !("excludes" in options)); + if (options.exact === undefined) this.raiseError("Expected no completions"); + this.verifyCompletionsAreExactly(actualCompletions.entries, toArray(options.exact)); } else { if (options.includes) { @@ -877,7 +880,7 @@ namespace FourSlash { this.verifyCompletionEntry(found, include); } } - else { + if (options.excludes) { for (const exclude of toArray(options.excludes)) { if (typeof exclude === "string") { if (actualByName.has(exclude)) { @@ -944,7 +947,7 @@ namespace FourSlash { } public verifyCompletionsAt(markerName: string | ReadonlyArray, expected: ReadonlyArray, options?: FourSlashInterface.CompletionsAtOptions) { - this.verifyCompletions({ at: markerName, are: expected, isNewIdentifierLocation: options && options.isNewIdentifierLocation, preferences: options, triggerCharacter: options && options.triggerCharacter }); + this.verifyCompletions({ marker: markerName, exact: expected, isNewIdentifierLocation: options && options.isNewIdentifierLocation, preferences: options, triggerCharacter: options && options.triggerCharacter }); } public verifyCompletionListContains(entryId: ts.Completions.CompletionEntryIdentifier, text?: string, documentation?: string, kind?: string | { kind?: string, kindModifiers?: string }, spanIndex?: number, hasAction?: boolean, options?: FourSlashInterface.VerifyCompletionListContainsOptions) { @@ -1180,7 +1183,7 @@ namespace FourSlash { } } - public verifyReferenceGroups(starts: Many | Many, parts: ReadonlyArray | undefined): void { + public verifyReferenceGroups(starts: ArrayOrSingle | ArrayOrSingle, parts: ReadonlyArray | undefined): void { interface ReferenceGroupJson { definition: string | { text: string, range: ts.TextSpan }; references: ts.ReferenceEntry[]; @@ -1415,7 +1418,7 @@ Actual: ${stringify(fullActual)}`); } } - public verifyRenameLocations(startRanges: Many, options: Range[] | { findInStrings?: boolean, findInComments?: boolean, ranges: Range[] }) { + public verifyRenameLocations(startRanges: ArrayOrSingle, options: Range[] | { findInStrings?: boolean, findInComments?: boolean, ranges: Range[] }) { let findInStrings: boolean, findInComments: boolean, ranges: Range[]; if (ts.isArray(options)) { findInStrings = findInComments = false; @@ -3805,7 +3808,7 @@ ${code} return ts.arrayFrom(set.keys()); } - function toArray(x: Many): ReadonlyArray { + function toArray(x: ArrayOrSingle): ReadonlyArray { return ts.isArray(x) ? x : [x]; } @@ -4753,9 +4756,9 @@ namespace FourSlashInterface { } export interface VerifyCompletionsOptions { - readonly at?: Many; + readonly marker?: Many; readonly isNewIdentifierLocation?: boolean; - readonly are?: Many; + readonly exact?: Many; readonly includes?: Many; readonly excludes?: Many; readonly preferences: ts.UserPreferences; diff --git a/tests/cases/fourslash/augmentedTypesClass1.ts b/tests/cases/fourslash/augmentedTypesClass1.ts index 3aae8acc63f2a..2f1295ccca87c 100644 --- a/tests/cases/fourslash/augmentedTypesClass1.ts +++ b/tests/cases/fourslash/augmentedTypesClass1.ts @@ -6,6 +6,6 @@ ////var r = new c5b(); ////r./*2*/ -verify.completions({ at: "1", includes: { name: "prototype", text: '(property) c5b.prototype: c5b' } }); +verify.completions({ marker: "1", includes: { name: "prototype", text: '(property) c5b.prototype: c5b' } }); edit.insert('y;'); -verify.completions({ at: "2", includes: { name: "foo", text: '(method) c5b.foo(): void' } }); +verify.completions({ marker: "2", includes: { name: "foo", text: '(method) c5b.foo(): void' } }); diff --git a/tests/cases/fourslash/augmentedTypesModule6.ts b/tests/cases/fourslash/augmentedTypesModule6.ts index de127c87f12d6..3dcde637a7c8b 100644 --- a/tests/cases/fourslash/augmentedTypesModule6.ts +++ b/tests/cases/fourslash/augmentedTypesModule6.ts @@ -8,19 +8,19 @@ ////var r2: m3f.I = r; ////r2./*6*/ -verify.completions({ at: "1", includes: "I", excludes: "foo" }); +verify.completions({ marker: "1", includes: "I", excludes: "foo" }); edit.insert('I;'); -verify.completions({ at: "2", includes: "m3f" }); +verify.completions({ marker: "2", includes: "m3f" }); goTo.marker('3'); verify.currentSignatureHelpIs('m3f(): m3f'); verify.quickInfoAt("4", "var r: m3f"); -verify.completions({ at: "5", includes: "foo" }); +verify.completions({ marker: "5", includes: "foo" }); edit.insert('foo(1)'); -verify.completions({ at: "6", includes: "foo" }); +verify.completions({ marker: "6", includes: "foo" }); edit.insert('foo('); verify.currentSignatureHelpIs('foo(): void'); diff --git a/tests/cases/fourslash/cloduleAsBaseClass2.ts b/tests/cases/fourslash/cloduleAsBaseClass2.ts index bb09370443edb..273ac2a0f9277 100644 --- a/tests/cases/fourslash/cloduleAsBaseClass2.ts +++ b/tests/cases/fourslash/cloduleAsBaseClass2.ts @@ -28,10 +28,10 @@ ////d./*1*/ ////D./*2*/ -verify.completions({ at: "1", are: ["foo2", "foo"] }); +verify.completions({ marker: "1", exact: ["foo2", "foo"] }); edit.insert('foo()'); -verify.completions({ at: "2", includes: ["bar", "bar2", "baz", "x"], excludes: ["foo", "foo2"] }); +verify.completions({ marker: "2", includes: ["bar", "bar2", "baz", "x"], excludes: ["foo", "foo2"] }); edit.insert('bar()'); verify.noErrors(); diff --git a/tests/cases/fourslash/cloduleTypeOf1.ts b/tests/cases/fourslash/cloduleTypeOf1.ts index 6ef1e9ed816fb..4f936f4365e88 100644 --- a/tests/cases/fourslash/cloduleTypeOf1.ts +++ b/tests/cases/fourslash/cloduleTypeOf1.ts @@ -14,14 +14,14 @@ //// } ////} -verify.completions({ at: "1", includes: ["f", "foo"] }); +verify.completions({ marker: "1", includes: ["f", "foo"] }); edit.insert('foo(1);'); -verify.completions({ at: "2", includes: "x" }); +verify.completions({ marker: "2", includes: "x" }); verify.quickInfoAt("3", "(local var) r: C"); -verify.completions({ at: "4", includes: "x" }); +verify.completions({ marker: "4", includes: "x" }); edit.insert('x;'); verify.quickInfoAt("5", "(local var) r2: number"); diff --git a/tests/cases/fourslash/commentsEnums.ts b/tests/cases/fourslash/commentsEnums.ts index 504c804febb96..9fb29d4442b33 100644 --- a/tests/cases/fourslash/commentsEnums.ts +++ b/tests/cases/fourslash/commentsEnums.ts @@ -18,7 +18,7 @@ verify.quickInfos({ }); verify.completions({ - at: "5", + marker: "5", includes: { name: "Colors", text: "enum Colors", documentation: "Enum of colors" }, isNewIdentifierLocation: true, }); @@ -28,8 +28,8 @@ const completions = [ { name: "Cornflower", text: "(enum member) Colors.Cornflower = 0", documentation: "Fancy name for 'blue'" }, { name: "FancyPink", text: "(enum member) Colors.FancyPink = 1", documentation: "Fancy name for 'pink'" }, ]; -verify.completions({ at: "6", includes: completions }); +verify.completions({ marker: "6", includes: completions }); verify.quickInfoIs("(enum member) Colors.Cornflower = 0", "Fancy name for 'blue'"); -verify.completions({ at: "7", includes: completions }); +verify.completions({ marker: "7", includes: completions }); verify.quickInfoIs("(enum member) Colors.FancyPink = 1", "Fancy name for 'pink'"); \ No newline at end of file diff --git a/tests/cases/fourslash/commentsImportDeclaration.ts b/tests/cases/fourslash/commentsImportDeclaration.ts index cce59ac5f4b1a..7f8a328d6d1d0 100644 --- a/tests/cases/fourslash/commentsImportDeclaration.ts +++ b/tests/cases/fourslash/commentsImportDeclaration.ts @@ -29,11 +29,11 @@ verify.quickInfos({ 3: ['import extMod = require("./commentsImportDeclaration_file0")', "Import declaration"] }); -verify.completions({ at: "6", are: [{ name: "m1", text: "namespace extMod.m1", documentation: "NamespaceComment" }] }); +verify.completions({ marker: "6", exact: [{ name: "m1", text: "namespace extMod.m1", documentation: "NamespaceComment" }] }); verify.completions({ - at: "7", - are: [ + marker: "7", + exact: [ { name: "fooExport", text: "function extMod.m1.fooExport(): number", documentation: "exported function" }, { name: "b", text: "var extMod.m1.b: number", documentation: "b's comment" }, { name: "m2", text: "namespace extMod.m1.m2", documentation: "m2 comments" }, @@ -48,8 +48,8 @@ verify.quickInfos({ }); verify.completions({ - at: "10", - are: [ + marker: "10", + exact: [ { name: "c", text: "constructor extMod.m1.m2.c(): extMod.m1.m2.c" }, { name: "i", text: "var extMod.m1.m2.i: extMod.m1.m2.c", documentation: "i" }, ], diff --git a/tests/cases/fourslash/commentsVariables.ts b/tests/cases/fourslash/commentsVariables.ts index 3a3b2a28adc11..c8266e5e77647 100644 --- a/tests/cases/fourslash/commentsVariables.ts +++ b/tests/cases/fourslash/commentsVariables.ts @@ -45,18 +45,18 @@ verify.quickInfoAt("1", "var myVariable: number", "This is my variable"); verify.completions( { - at: "2", + marker: "2", includes: { name: "myVariable", text: "var myVariable: number", documentation: "This is my variable" }, }, { - at: "3", + marker: "3", includes: [ { name: "myVariable", text: "var myVariable: number", documentation: "This is my variable" }, { name: "d", text: "var d: number", documentation: "d variable" } ], }, { - at: "4", + marker: "4", includes: [ { name: "foo", text: "function foo(): void", documentation: "foos comment" }, { name: "fooVar", text: "var fooVar: () => void", documentation:"fooVar comment" }, @@ -73,7 +73,7 @@ verify.currentSignatureHelpDocCommentIs("fooVar comment"); verify.quickInfoAt("6q", "var fooVar: () => void", "fooVar comment"); verify.completions({ - at: "7", + marker: "7", includes: [ { name: "foo", text: "function foo(): void", documentation: "foos comment" }, { name: "fooVar", text: "var fooVar: () => void", documentation:"fooVar comment" }, @@ -91,8 +91,8 @@ verify.quickInfos({ "9aq": ["var fooVar: () => void", "fooVar comment"] }); -verify.completions({ at: "10", includes: { name: "i", text: "var i: c", documentation: "instance comment" } }); -verify.completions({ at: "11", includes: { name: "i1_i", text: "var i1_i: i1", documentation: "interface instance comments" } }); +verify.completions({ marker: "10", includes: { name: "i", text: "var i: c", documentation: "instance comment" } }); +verify.completions({ marker: "11", includes: { name: "i1_i", text: "var i1_i: i1", documentation: "interface instance comments" } }); verify.quickInfos({ 12: ["var fooVar: () => void", "fooVar comment"], diff --git a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport10.ts b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport10.ts index 19053881d37f0..d85d207dc0449 100644 --- a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport10.ts +++ b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport10.ts @@ -24,4 +24,4 @@ // @Filename: dir1/dir2/dir3/node_modules/fake-module3/ts.ts //// -verify.completions({ at: test.markerNames(), are: [], isNewIdentifierLocation: true }); +verify.completions({ marker: test.markerNames(), exact: [], isNewIdentifierLocation: true }); diff --git a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport11.ts b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport11.ts index 9cb8827872c9d..cbabf317cc3ee 100644 --- a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport11.ts +++ b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport11.ts @@ -24,13 +24,13 @@ const kinds = ["import_as", "import_equals", "require"]; verify.completions( { - at: kinds.map(k => `${k}0`), - are: "module", + marker: kinds.map(k => `${k}0`), + exact: "module", isNewIdentifierLocation: true, }, { - at: kinds.map(k => `${k}1`), - are: "index", + marker: kinds.map(k => `${k}1`), + exact: "index", isNewIdentifierLocation: true, }, ) diff --git a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport12.ts b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport12.ts index 1d39c1daf598f..4d7ffccf8b8c7 100644 --- a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport12.ts +++ b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport12.ts @@ -16,7 +16,7 @@ //// } verify.completions({ - at: test.markerNames(), - are: ["module", "dev-module", "peer-module", "optional-module"], + marker: test.markerNames(), + exact: ["module", "dev-module", "peer-module", "optional-module"], isNewIdentifierLocation: true, }); diff --git a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport4.ts b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport4.ts index e3451bb372f7c..e35ffa1992496 100644 --- a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport4.ts +++ b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport4.ts @@ -23,7 +23,7 @@ //// verify.completions({ - at: test.markerNames(), - are: ["fake-module3", "fake-module2", "fake-module"], + marker: test.markerNames(), + exact: ["fake-module3", "fake-module2", "fake-module"], isNewIdentifierLocation: true, }); diff --git a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport5.ts b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport5.ts index ad19a2b3714cf..63d5f425ee44b 100644 --- a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport5.ts +++ b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport5.ts @@ -22,12 +22,12 @@ //// declare module "otherOtherAmbientModule" {} verify.completions({ - at: test.markerNames().filter(k => k.endsWith("0")), - are: ["ambientModule", "otherAmbientModule", "otherOtherAmbientModule"], + marker: test.markerNames().filter(k => k.endsWith("0")), + exact: ["ambientModule", "otherAmbientModule", "otherOtherAmbientModule"], isNewIdentifierLocation: true, }); verify.completions({ - at: test.markerNames().filter(k => !k.endsWith("0")), - are: "ambientModule", + marker: test.markerNames().filter(k => !k.endsWith("0")), + exact: "ambientModule", isNewIdentifierLocation: true, }); diff --git a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport7.ts b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport7.ts index 2783ca9cca83e..f12c87c5fc3b5 100644 --- a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport7.ts +++ b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport7.ts @@ -18,7 +18,7 @@ //// verify.completions({ - at: test.markerNames(), - are: ["module", "module-from-node"], + marker: test.markerNames(), + exact: ["module", "module-from-node"], isNewIdentifierLocation: true, }); diff --git a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport8.ts b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport8.ts index 24557535699d2..f917f014a8295 100644 --- a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport8.ts +++ b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport8.ts @@ -41,7 +41,7 @@ //// export var z = 5; verify.completions({ - at: test.markerNames(), - are: ["prefix", "prefix-only", "2test", "0test", "1test"], + marker: test.markerNames(), + exact: ["prefix", "prefix-only", "2test", "0test", "1test"], isNewIdentifierLocation: true, }); diff --git a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport9.ts b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport9.ts index b6660a7974c91..3a5f28b0f0cc2 100644 --- a/tests/cases/fourslash/completionForStringLiteralNonrelativeImport9.ts +++ b/tests/cases/fourslash/completionForStringLiteralNonrelativeImport9.ts @@ -25,4 +25,4 @@ // @Filename: some/other/path.ts //// export var y = 10; -verify.completions({ at: test.markerNames(), are: ["module1", "module2"], isNewIdentifierLocation: true }); +verify.completions({ marker: test.markerNames(), exact: ["module1", "module2"], isNewIdentifierLocation: true }); diff --git a/tests/cases/fourslash/completionForStringLiteralRelativeImport3.ts b/tests/cases/fourslash/completionForStringLiteralRelativeImport3.ts index 84e2ab85e2304..efe1d60ed98ca 100644 --- a/tests/cases/fourslash/completionForStringLiteralRelativeImport3.ts +++ b/tests/cases/fourslash/completionForStringLiteralRelativeImport3.ts @@ -33,12 +33,12 @@ const kinds = ["import_as", "import_equals", "require"]; verify.completions( { - at: [...kinds.map(k => `${k}0`), ...kinds.map(k => `${k}1`)], - are: "fourslash", + marker: [...kinds.map(k => `${k}0`), ...kinds.map(k => `${k}1`)], + exact: "fourslash", isNewIdentifierLocation: true, }, { - at: kinds.map(k => `${k}2`), - are: ["e1", "f1", "f2", "tests", "folder"], + marker: kinds.map(k => `${k}2`), + exact: ["e1", "f1", "f2", "tests", "folder"], isNewIdentifierLocation: true, }); diff --git a/tests/cases/fourslash/completionForStringLiteralRelativeImport4.ts b/tests/cases/fourslash/completionForStringLiteralRelativeImport4.ts index dbaba4ae0ffcb..1cfacb08838f2 100644 --- a/tests/cases/fourslash/completionForStringLiteralRelativeImport4.ts +++ b/tests/cases/fourslash/completionForStringLiteralRelativeImport4.ts @@ -38,7 +38,7 @@ //// verify.completions({ - at: test.markerNames(), - are: ["module1", "module2", "more", "module0"], + marker: test.markerNames(), + exact: ["module1", "module2", "more", "module0"], isNewIdentifierLocation: true, }); diff --git a/tests/cases/fourslash/completionListInUnclosedFunction01.ts b/tests/cases/fourslash/completionListInUnclosedFunction01.ts index e4dab0bb92a7f..1c2d7bda1f0f7 100644 --- a/tests/cases/fourslash/completionListInUnclosedFunction01.ts +++ b/tests/cases/fourslash/completionListInUnclosedFunction01.ts @@ -4,4 +4,4 @@ //// /*1*/ //// -verify.completions({ at: "1", includes: ["foo", "x", "y", "z"] }); +verify.completions({ marker: "1", includes: ["foo", "x", "y", "z"] }); diff --git a/tests/cases/fourslash/completionListInUnclosedFunction02.ts b/tests/cases/fourslash/completionListInUnclosedFunction02.ts index 9b9409bf90a71..b46d51d2f69f6 100644 --- a/tests/cases/fourslash/completionListInUnclosedFunction02.ts +++ b/tests/cases/fourslash/completionListInUnclosedFunction02.ts @@ -4,4 +4,4 @@ //// function bar(a: number, b: string, c: typeof /*1*/ // Note: Ideally `c` wouldn't be included since it hasn't been initialized yet. -verify.completions({ at: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c"]}) +verify.completions({ marker: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c"]}) diff --git a/tests/cases/fourslash/completionListInUnclosedFunction03.ts b/tests/cases/fourslash/completionListInUnclosedFunction03.ts index 165b98a21ec60..b094fe2e725d9 100644 --- a/tests/cases/fourslash/completionListInUnclosedFunction03.ts +++ b/tests/cases/fourslash/completionListInUnclosedFunction03.ts @@ -5,4 +5,4 @@ ////} // Note: Ideally `c` wouldn't be included since it hasn't been initialized yet. -verify.completions({ at: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c"]}) +verify.completions({ marker: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c"]}) diff --git a/tests/cases/fourslash/completionListInUnclosedFunction04.ts b/tests/cases/fourslash/completionListInUnclosedFunction04.ts index cfc880c060b1d..543b1bd321386 100644 --- a/tests/cases/fourslash/completionListInUnclosedFunction04.ts +++ b/tests/cases/fourslash/completionListInUnclosedFunction04.ts @@ -4,4 +4,4 @@ //// function bar(a: number, b: string, c: typeof x = /*1*/ // Note: Ideally `c` wouldn't be included since it hasn't been initialized yet. -verify.completions({ at: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c"]}) +verify.completions({ marker: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c"]}) diff --git a/tests/cases/fourslash/completionListInUnclosedFunction05.ts b/tests/cases/fourslash/completionListInUnclosedFunction05.ts index b7c3a99a395c1..82d3611001d35 100644 --- a/tests/cases/fourslash/completionListInUnclosedFunction05.ts +++ b/tests/cases/fourslash/completionListInUnclosedFunction05.ts @@ -5,4 +5,4 @@ ////} // Note: Ideally `c` wouldn't be included since it hasn't been initialized yet. -verify.completions({ at: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c"]}) +verify.completions({ marker: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c"]}) diff --git a/tests/cases/fourslash/completionListInUnclosedFunction06.ts b/tests/cases/fourslash/completionListInUnclosedFunction06.ts index a588048cbbcaf..21b1349a60762 100644 --- a/tests/cases/fourslash/completionListInUnclosedFunction06.ts +++ b/tests/cases/fourslash/completionListInUnclosedFunction06.ts @@ -5,4 +5,4 @@ //// // Note: Ideally `c` wouldn't be included since it hasn't been initialized yet. -verify.completions({ at: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c"]}) +verify.completions({ marker: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c"]}) diff --git a/tests/cases/fourslash/completionListInUnclosedFunction07.ts b/tests/cases/fourslash/completionListInUnclosedFunction07.ts index 1a100d82a2c98..7863d9dd1f36c 100644 --- a/tests/cases/fourslash/completionListInUnclosedFunction07.ts +++ b/tests/cases/fourslash/completionListInUnclosedFunction07.ts @@ -5,4 +5,4 @@ ////} // Note: Ideally `c` wouldn't be included since it hasn't been initialized yet. -verify.completions({ at: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c"]}) +verify.completions({ marker: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c"]}) diff --git a/tests/cases/fourslash/completionListInUnclosedFunction08.ts b/tests/cases/fourslash/completionListInUnclosedFunction08.ts index 668063e9246bc..c0616881bd6a9 100644 --- a/tests/cases/fourslash/completionListInUnclosedFunction08.ts +++ b/tests/cases/fourslash/completionListInUnclosedFunction08.ts @@ -5,4 +5,4 @@ //// var v = /*1*/ // Note: "v" questionable since we're in its initializer -verify.completions({ at: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c", "v"], isNewIdentifierLocation: true }); +verify.completions({ marker: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c", "v"], isNewIdentifierLocation: true }); diff --git a/tests/cases/fourslash/completionListInUnclosedFunction09.ts b/tests/cases/fourslash/completionListInUnclosedFunction09.ts index 24d34cc0e2a20..14827b1a891cd 100644 --- a/tests/cases/fourslash/completionListInUnclosedFunction09.ts +++ b/tests/cases/fourslash/completionListInUnclosedFunction09.ts @@ -6,4 +6,4 @@ ////} // Note: "v" questionable since we're in its initializer -verify.completions({ at: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c", "v"], isNewIdentifierLocation: true }); +verify.completions({ marker: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c", "v"], isNewIdentifierLocation: true }); diff --git a/tests/cases/fourslash/completionListInUnclosedFunction10.ts b/tests/cases/fourslash/completionListInUnclosedFunction10.ts index 3123d4f2ce0a9..e35cb97432b44 100644 --- a/tests/cases/fourslash/completionListInUnclosedFunction10.ts +++ b/tests/cases/fourslash/completionListInUnclosedFunction10.ts @@ -7,4 +7,4 @@ //// function bar(a: number, b: string = "hello", c: typeof x = "hello") { //// var v = (p: /*1*/ -verify.completions({ at: "1", includes: "MyType" }); +verify.completions({ marker: "1", includes: "MyType" }); diff --git a/tests/cases/fourslash/completionListInUnclosedFunction11.ts b/tests/cases/fourslash/completionListInUnclosedFunction11.ts index 3123d4f2ce0a9..e35cb97432b44 100644 --- a/tests/cases/fourslash/completionListInUnclosedFunction11.ts +++ b/tests/cases/fourslash/completionListInUnclosedFunction11.ts @@ -7,4 +7,4 @@ //// function bar(a: number, b: string = "hello", c: typeof x = "hello") { //// var v = (p: /*1*/ -verify.completions({ at: "1", includes: "MyType" }); +verify.completions({ marker: "1", includes: "MyType" }); diff --git a/tests/cases/fourslash/completionListInUnclosedFunction12.ts b/tests/cases/fourslash/completionListInUnclosedFunction12.ts index b1f65c72b1b86..161a483065a89 100644 --- a/tests/cases/fourslash/completionListInUnclosedFunction12.ts +++ b/tests/cases/fourslash/completionListInUnclosedFunction12.ts @@ -8,4 +8,4 @@ //// var v = (p: /*1*/ ////} -verify.completions({ at: "1", includes: "MyType" }); +verify.completions({ marker: "1", includes: "MyType" }); diff --git a/tests/cases/fourslash/completionListInUnclosedFunction13.ts b/tests/cases/fourslash/completionListInUnclosedFunction13.ts index 5ffb0a7f28f50..a129c4a63302f 100644 --- a/tests/cases/fourslash/completionListInUnclosedFunction13.ts +++ b/tests/cases/fourslash/completionListInUnclosedFunction13.ts @@ -9,4 +9,4 @@ //// } ////} -verify.completions({ at: "1", includes: "MyType" }); +verify.completions({ marker: "1", includes: "MyType" }); diff --git a/tests/cases/fourslash/completionListInUnclosedFunction14.ts b/tests/cases/fourslash/completionListInUnclosedFunction14.ts index 4d905e8b2be00..0fcab57cde00e 100644 --- a/tests/cases/fourslash/completionListInUnclosedFunction14.ts +++ b/tests/cases/fourslash/completionListInUnclosedFunction14.ts @@ -9,4 +9,4 @@ //// } ////} -verify.completions({ at: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c", "v", "p"] }); +verify.completions({ marker: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c", "v", "p"] }); diff --git a/tests/cases/fourslash/completionListInUnclosedFunction15.ts b/tests/cases/fourslash/completionListInUnclosedFunction15.ts index 84679bca3b3d3..f0c5e9fd46dbb 100644 --- a/tests/cases/fourslash/completionListInUnclosedFunction15.ts +++ b/tests/cases/fourslash/completionListInUnclosedFunction15.ts @@ -8,4 +8,4 @@ //// var v = (p: MyType) => /*1*/ ////} -verify.completions({ at: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c", "v", "p"] }); +verify.completions({ marker: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c", "v", "p"] }); diff --git a/tests/cases/fourslash/completionListInUnclosedFunction16.ts b/tests/cases/fourslash/completionListInUnclosedFunction16.ts index bce5a2224ac3b..0abf8748be156 100644 --- a/tests/cases/fourslash/completionListInUnclosedFunction16.ts +++ b/tests/cases/fourslash/completionListInUnclosedFunction16.ts @@ -7,4 +7,4 @@ //// function bar(a: number, b: string = "hello", c: typeof x = "hello") { //// var v = (p: MyType) => /*1*/ -verify.completions({ at: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c", "v", "p"] }); +verify.completions({ marker: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c", "v", "p"] }); diff --git a/tests/cases/fourslash/completionListInUnclosedFunction17.ts b/tests/cases/fourslash/completionListInUnclosedFunction17.ts index 6c383405434ef..4a245354a1617 100644 --- a/tests/cases/fourslash/completionListInUnclosedFunction17.ts +++ b/tests/cases/fourslash/completionListInUnclosedFunction17.ts @@ -7,4 +7,4 @@ //// function bar(a: number, b: string = "hello", c: typeof x = "hello") { //// var v = (p: MyType) => y + /*1*/ -verify.completions({ at: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c", "v", "p"] }); +verify.completions({ marker: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c", "v", "p"] }); diff --git a/tests/cases/fourslash/completionListInUnclosedFunction18.ts b/tests/cases/fourslash/completionListInUnclosedFunction18.ts index a8769c5848b04..0d759e7f20962 100644 --- a/tests/cases/fourslash/completionListInUnclosedFunction18.ts +++ b/tests/cases/fourslash/completionListInUnclosedFunction18.ts @@ -8,4 +8,4 @@ //// var v = (p: MyType) => y + /*1*/ ////} -verify.completions({ at: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c", "v", "p"] }); +verify.completions({ marker: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c", "v", "p"] }); diff --git a/tests/cases/fourslash/completionListInUnclosedFunction19.ts b/tests/cases/fourslash/completionListInUnclosedFunction19.ts index b24d9706c36e6..534f7784085af 100644 --- a/tests/cases/fourslash/completionListInUnclosedFunction19.ts +++ b/tests/cases/fourslash/completionListInUnclosedFunction19.ts @@ -7,4 +7,4 @@ //// function bar(a: number, b: string = "hello", c: typeof x = "hello") { //// var v = (p: MyType) => { return y + /*1*/ -verify.completions({ at: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c", "v", "p"] }); +verify.completions({ marker: "1", includes: ["foo", "x", "y", "z", "bar", "a", "b", "c", "v", "p"] }); diff --git a/tests/cases/fourslash/completionListInUnclosedObjectTypeLiteralInSignature02.ts b/tests/cases/fourslash/completionListInUnclosedObjectTypeLiteralInSignature02.ts index fbec33e8dce7e..41e38588f81f4 100644 --- a/tests/cases/fourslash/completionListInUnclosedObjectTypeLiteralInSignature02.ts +++ b/tests/cases/fourslash/completionListInUnclosedObjectTypeLiteralInSignature02.ts @@ -8,7 +8,7 @@ ////declare function foo(obj: I): { str: TStr/*1*/ verify.completions({ - at: "1", + marker: "1", includes: ["I", "TString", "TNumber"], // REVIEW: Is TNumber intended behavior? excludes: ["foo", "obj"], // These shouldn't show up since they're not types. }) diff --git a/tests/cases/fourslash/completionListProtectedMembers.ts b/tests/cases/fourslash/completionListProtectedMembers.ts index b83ea4145605a..bf54a7b4d7af8 100644 --- a/tests/cases/fourslash/completionListProtectedMembers.ts +++ b/tests/cases/fourslash/completionListProtectedMembers.ts @@ -19,9 +19,9 @@ ////f./*5*/ verify.completions( - { at: "1", are: ["y", "x", "method"] }, - { at: "2", are: ["z", "method1", "y", "x", "method"] }, - { at: "3", are: ["method2", "y", "x", "method"] }, - { at: "4", are: ["method2", "z", "method1", "y", "x", "method"] }, - { at: "5", are: undefined }, + { marker: "1", exact: ["y", "x", "method"] }, + { marker: "2", exact: ["z", "method1", "y", "x", "method"] }, + { marker: "3", exact: ["method2", "y", "x", "method"] }, + { marker: "4", exact: ["method2", "z", "method1", "y", "x", "method"] }, + { marker: "5", exact: undefined }, ); diff --git a/tests/cases/fourslash/completionListStaticProtectedMembers.ts b/tests/cases/fourslash/completionListStaticProtectedMembers.ts index 261d6ffab1617..9b93d93a39201 100644 --- a/tests/cases/fourslash/completionListStaticProtectedMembers.ts +++ b/tests/cases/fourslash/completionListStaticProtectedMembers.ts @@ -27,12 +27,12 @@ verify.completions( { - at: ["1", "2"], + marker: ["1", "2"], // Same class, everything is visible includes: ["privateMethod", "privateProperty", "protectedMethod", "protectedProperty", "publicMethod", "publicProperty", "protectedOverriddenMethod", "protectedOverriddenProperty"], }, { - at: "3", + marker: "3", includes: ["privateMethod", "privateProperty", "protectedMethod", "protectedProperty", "publicMethod", "publicProperty"], // Can not access protected properties overridden in subclass excludes: ["protectedOverriddenMethod", "protectedOverriddenProperty"], diff --git a/tests/cases/fourslash/completionListSuperMembers.ts b/tests/cases/fourslash/completionListSuperMembers.ts index fa625a551b29b..cd0072e444d6e 100644 --- a/tests/cases/fourslash/completionListSuperMembers.ts +++ b/tests/cases/fourslash/completionListSuperMembers.ts @@ -24,7 +24,7 @@ ////} verify.completions({ - at: "", + marker: "", includes: "publicInstanceMethod", excludes: [ "publicProperty", diff --git a/tests/cases/fourslash/completionListWithAmbientDeclaration.ts b/tests/cases/fourslash/completionListWithAmbientDeclaration.ts index 4bee0ead05b5b..0d5a6b62321fa 100644 --- a/tests/cases/fourslash/completionListWithAmbientDeclaration.ts +++ b/tests/cases/fourslash/completionListWithAmbientDeclaration.ts @@ -9,6 +9,6 @@ //// /*2*/ verify.completions( - { at: "1", excludes: "http" }, - { at: "2", excludes: ["http", "https"] }, + { marker: "1", excludes: "http" }, + { marker: "2", excludes: ["http", "https"] }, ); diff --git a/tests/cases/fourslash/completionsImport_compilerOptionsModule.ts b/tests/cases/fourslash/completionsImport_compilerOptionsModule.ts index 1e40bb1a3c687..a5b8b0c07c249 100644 --- a/tests/cases/fourslash/completionsImport_compilerOptionsModule.ts +++ b/tests/cases/fourslash/completionsImport_compilerOptionsModule.ts @@ -24,9 +24,9 @@ ////const a = import("./a"); // Does not make this an external module ////fo/*d2*/ -verify.completions({ at: ["b", "c", "d"], excludes: "foo", preferences: { includeCompletionsForModuleExports: true } }); +verify.completions({ marker: ["b", "c", "d"], excludes: "foo", preferences: { includeCompletionsForModuleExports: true } }); verify.completions({ - at: ["c2", "d2"], + marker: ["c2", "d2"], includes: [{ name: "foo", source: "/node_modules/a/index", text: "const foo: 0", kind: "const", hasAction: true, sourceDisplay: "a" }], preferences: { includeCompletionsForModuleExports: true }, }); diff --git a/tests/cases/fourslash/completionsImport_defaultFalsePositive.ts b/tests/cases/fourslash/completionsImport_defaultFalsePositive.ts index b03631082a686..65088dc775648 100644 --- a/tests/cases/fourslash/completionsImport_defaultFalsePositive.ts +++ b/tests/cases/fourslash/completionsImport_defaultFalsePositive.ts @@ -13,7 +13,7 @@ goTo.file("/a.ts"); verify.completions({ - at: "", + marker: "", includes: [ { name: "concat", source: "/node_modules/bar/concat", sourceDisplay: "bar/concat", text: "const concat: 0", kind: "const", hasAction: true }, ], diff --git a/tests/cases/fourslash/completionsImport_default_anonymous.ts b/tests/cases/fourslash/completionsImport_default_anonymous.ts index ae1991491028c..17a26b4b5aac4 100644 --- a/tests/cases/fourslash/completionsImport_default_anonymous.ts +++ b/tests/cases/fourslash/completionsImport_default_anonymous.ts @@ -13,8 +13,8 @@ goTo.marker("0"); const preferences = { includeCompletionsForModuleExports: true }; verify.completions( - { at: "0", excludes: { name: "default", source: "/src/foo-bar" }, preferences }, - { at: "1", includes: { name: "fooBar", source: "/src/foo-bar", sourceDisplay: "./foo-bar", text: "(property) default: 0", kind: "property", hasAction: true }, preferences } + { marker: "0", excludes: { name: "default", source: "/src/foo-bar" }, preferences }, + { marker: "1", includes: { name: "fooBar", source: "/src/foo-bar", sourceDisplay: "./foo-bar", text: "(property) default: 0", kind: "property", hasAction: true }, preferences } ); verify.applyCodeActionFromCompletion("1", { name: "fooBar", diff --git a/tests/cases/fourslash/completionsImport_matching.ts b/tests/cases/fourslash/completionsImport_matching.ts index 24debd00c8542..92c09b49644de 100644 --- a/tests/cases/fourslash/completionsImport_matching.ts +++ b/tests/cases/fourslash/completionsImport_matching.ts @@ -15,7 +15,7 @@ ////bdf/**/ verify.completions({ - at: "", + marker: "", includes: ["bdf", "abcdef", "BDF"].map(name => ({ name, source: "/a", text: `function ${name}(): void`, hasAction: true, kind: "function", sourceDisplay: "./a" })), excludes: ["abcde", "dbf"], diff --git a/tests/cases/fourslash/completionsImport_named_didNotExistBefore.ts b/tests/cases/fourslash/completionsImport_named_didNotExistBefore.ts index 662c03c7c0637..94ed1b8a0fa25 100644 --- a/tests/cases/fourslash/completionsImport_named_didNotExistBefore.ts +++ b/tests/cases/fourslash/completionsImport_named_didNotExistBefore.ts @@ -10,7 +10,7 @@ ////t/**/ verify.completions({ - at: "", + marker: "", includes: [ { name: "Test1", source: "/a", sourceDisplay: "./a", text: "function Test1(): void", kind: "function", hasAction: true }, { name: "Test2", text: "(alias) function Test2(): void\nimport Test2", kind: "alias" }, diff --git a/tests/cases/fourslash/completionsImport_notFromUnrelatedNodeModules.ts b/tests/cases/fourslash/completionsImport_notFromUnrelatedNodeModules.ts index 63f4612a89951..65e58619dfcee 100644 --- a/tests/cases/fourslash/completionsImport_notFromUnrelatedNodeModules.ts +++ b/tests/cases/fourslash/completionsImport_notFromUnrelatedNodeModules.ts @@ -8,4 +8,4 @@ // @Filename: /src/b.ts ////fo/**/; -verify.completions({ at: "", excludes: "foo", preferences: { includeCompletionsForModuleExports: true } }); +verify.completions({ marker: "", excludes: "foo", preferences: { includeCompletionsForModuleExports: true } }); diff --git a/tests/cases/fourslash/completionsImport_ofAlias.ts b/tests/cases/fourslash/completionsImport_ofAlias.ts index f8a0f7f5c02bc..708a5b99d3a53 100644 --- a/tests/cases/fourslash/completionsImport_ofAlias.ts +++ b/tests/cases/fourslash/completionsImport_ofAlias.ts @@ -20,7 +20,7 @@ ////fo/**/ verify.completions({ - at: "", + marker: "", includes: { name: "foo", source: "/a", sourceDisplay: "./a", text: "(alias) const foo: 0\nexport foo", kind: "alias", hasAction: true }, excludes: [{ name: "foo", source: "/a_reexport" }, { name: "foo", source: "/a_reexport_2" }], preferences: { includeCompletionsForModuleExports: true }, diff --git a/tests/cases/fourslash/completionsImport_ofAlias_preferShortPath.ts b/tests/cases/fourslash/completionsImport_ofAlias_preferShortPath.ts index 9b432dcaa9174..78ac08a1c124d 100644 --- a/tests/cases/fourslash/completionsImport_ofAlias_preferShortPath.ts +++ b/tests/cases/fourslash/completionsImport_ofAlias_preferShortPath.ts @@ -16,7 +16,7 @@ ////fo/**/ verify.completions({ - at: "", + marker: "", includes: { name: "foo", source: "/foo/lib/foo", sourceDisplay: "./foo", text: "const foo: 0", kind: "const", hasAction: true }, excludes: { name: "foo", source: "/foo/index" }, preferences: { includeCompletionsForModuleExports: true }, diff --git a/tests/cases/fourslash/completionsImport_shadowedByLocal.ts b/tests/cases/fourslash/completionsImport_shadowedByLocal.ts index 0747e7177cdc8..7ad88ff4d2fee 100644 --- a/tests/cases/fourslash/completionsImport_shadowedByLocal.ts +++ b/tests/cases/fourslash/completionsImport_shadowedByLocal.ts @@ -8,7 +8,7 @@ ////fo/**/ verify.completions({ - at: "", + marker: "", includes: "foo", excludes: { name: "foo", source: "/a" }, preferences: { includeCompletionsForModuleExports: true }, diff --git a/tests/cases/fourslash/completionsPaths_kinds.ts b/tests/cases/fourslash/completionsPaths_kinds.ts index 2f8de6760af14..984ed17df2232 100644 --- a/tests/cases/fourslash/completionsPaths_kinds.ts +++ b/tests/cases/fourslash/completionsPaths_kinds.ts @@ -21,7 +21,7 @@ ////} verify.completions({ - at: ["0", "1"], - are: [{ name: "b", kind: "script" }, { name: "dir", kind: "directory" }], + marker: ["0", "1"], + exact: [{ name: "b", kind: "script" }, { name: "dir", kind: "directory" }], isNewIdentifierLocation: true }); diff --git a/tests/cases/fourslash/completionsTriggerCharacter.ts b/tests/cases/fourslash/completionsTriggerCharacter.ts index 0d7d9532216f8..13e76f5abe893 100644 --- a/tests/cases/fourslash/completionsTriggerCharacter.ts +++ b/tests/cases/fourslash/completionsTriggerCharacter.ts @@ -20,18 +20,18 @@ ////const less = 1 verify.completions( - { at: "1", includes: "toFixed" }, - { at: "2", are: ["length", "add", "remove"] }, + { marker: "1", includes: "toFixed" }, + { marker: "2", exact: ["length", "add", "remove"] }, ); verifyCompletions(); diff --git a/tests/cases/fourslash/extendArrayInterfaceMember.ts b/tests/cases/fourslash/extendArrayInterfaceMember.ts index 6c026e8d0d96c..b8e8cea35b389 100644 --- a/tests/cases/fourslash/extendArrayInterfaceMember.ts +++ b/tests/cases/fourslash/extendArrayInterfaceMember.ts @@ -6,7 +6,7 @@ verify.errorExistsBetweenMarkers("1", "2"); verify.numberOfErrorsInCurrentFile(1); -// Expected errors are: +// Expected errors exact: // - Supplied parameters do not match any signature of call target. // - Could not select overload for 'call' expression. diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 50e36b7ca6655..cf554831434ed 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -202,15 +202,15 @@ declare namespace FourSlashInterface { assertHasRanges(ranges: Range[]): void; caretAtMarker(markerName?: string): void; completions(...options: { - readonly at?: Many, + readonly marker?: ArrayOrSingle, readonly isNewIdentifierLocation?: boolean; - readonly are?: Many; - readonly includes?: Many; - readonly excludes?: Many; + readonly exact?: ArrayOrSingle; + readonly includes?: ArrayOrSingle; + readonly excludes?: ArrayOrSingle; readonly preferences?: UserPreferences; readonly triggerCharacter?: string; }[]): void; - completionsAt(markerName: Many, completions: ReadonlyArray, options?: CompletionsAtOptions): void; + completionsAt(markerName: ArrayOrSingle, completions: ReadonlyArray, options?: CompletionsAtOptions): void; applyCodeActionFromCompletion(markerName: string, options: { name: string, source?: string, @@ -231,23 +231,23 @@ declare namespace FourSlashInterface { currentLineContentIs(text: string): void; currentFileContentIs(text: string): void; /** Verifies that goToDefinition at the current position would take you to `endMarker`. */ - goToDefinitionIs(endMarkers: Many): void; + goToDefinitionIs(endMarkers: ArrayOrSingle): void; goToDefinitionName(name: string, containerName: string): void; /** * `verify.goToDefinition("a", "b");` verifies that go-to-definition at marker "a" takes you to marker "b". * `verify.goToDefinition(["a", "aa"], "b");` verifies that markers "a" and "aa" have the same definition "b". * `verify.goToDefinition("a", ["b", "bb"]);` verifies that "a" has multiple definitions available. */ - goToDefinition(startMarkerNames: Many, endMarkerNames: Many): void; - goToDefinition(startMarkerNames: Many, endMarkerNames: Many, range: Range): void; + goToDefinition(startMarkerNames: ArrayOrSingle, endMarkerNames: ArrayOrSingle): void; + goToDefinition(startMarkerNames: ArrayOrSingle, endMarkerNames: ArrayOrSingle, range: Range): void; /** Performs `goToDefinition` for each pair. */ - goToDefinition(startsAndEnds: [Many, Many][]): void; + goToDefinition(startsAndEnds: [ArrayOrSingle, ArrayOrSingle][]): void; /** Performs `goToDefinition` on each key and value. */ - goToDefinition(startsAndEnds: { [startMarkerName: string]: Many }): void; + goToDefinition(startsAndEnds: { [startMarkerName: string]: ArrayOrSingle }): void; /** Verifies goToDefinition for each `${markerName}Reference` -> `${markerName}Definition` */ goToDefinitionForMarkers(...markerNames: string[]): void; - goToType(startsAndEnds: { [startMarkerName: string]: Many }): void; - goToType(startMarkerNames: Many, endMarkerNames: Many): void; + goToType(startsAndEnds: { [startMarkerName: string]: ArrayOrSingle }): void; + goToType(startMarkerNames: ArrayOrSingle, endMarkerNames: ArrayOrSingle): void; verifyGetEmitOutputForCurrentFile(expected: string): void; verifyGetEmitOutputContentsForCurrentFile(expected: ts.OutputFile[]): void; noReferences(markerNameOrRange?: string | Range): void; @@ -263,7 +263,7 @@ declare namespace FourSlashInterface { * For each of starts, asserts the ranges that are referenced from there. * This uses the 'findReferences' command instead of 'getReferencesAtPosition', so references are grouped by their definition. */ - referenceGroups(starts: Many | Many, parts: Array<{ definition: ReferencesDefinition, ranges: Range[] }>): void; + referenceGroups(starts: ArrayOrSingle | ArrayOrSingle, parts: Array<{ definition: ReferencesDefinition, ranges: Range[] }>): void; singleReferenceGroup(definition: ReferencesDefinition, ranges?: Range[]): void; rangesAreOccurrences(isWriteAccess?: boolean): void; rangesWithSameTextAreRenameLocations(): void; @@ -334,7 +334,7 @@ declare namespace FourSlashInterface { }[]): void; renameInfoSucceeded(displayName?: string, fullDisplayName?: string, kind?: string, kindModifiers?: string): void; renameInfoFailed(message?: string): void; - renameLocations(startRanges: Many, options: Range[] | { findInStrings?: boolean, findInComments?: boolean, ranges: Range[] }): void; + renameLocations(startRanges: ArrayOrSingle, options: Range[] | { findInStrings?: boolean, findInComments?: boolean, ranges: Range[] }): void; /** Verify the quick info available at the current marker. */ quickInfoIs(expectedText: string, expectedDocumentation?: string): void; @@ -562,7 +562,7 @@ declare namespace FourSlashInterface { readonly sourceDisplay?: string, }; - type Many = T | ReadonlyArray; + type ArrayOrSingle = T | ReadonlyArray; } declare function verifyOperationIsCancelled(f: any): void; declare var test: FourSlashInterface.test_; diff --git a/tests/cases/fourslash/getJavaScriptCompletions12.ts b/tests/cases/fourslash/getJavaScriptCompletions12.ts index b916428e61061..df09b041e6230 100644 --- a/tests/cases/fourslash/getJavaScriptCompletions12.ts +++ b/tests/cases/fourslash/getJavaScriptCompletions12.ts @@ -24,7 +24,7 @@ ////var test1 = function(x) { return x./*4*/ }, test2 = function(a) { return a./*5*/ }; verify.completions( - { at: "1", includes: { name: "charCodeAt", kind: "method" }, isNewIdentifierLocation: true }, - { at: ["2", "3", "4"], includes: { name: "toExponential", kind: "method" } }, - { at: "5", includes: { name: "test1", kind: "warning" } }, + { marker: "1", includes: { name: "charCodeAt", kind: "method" }, isNewIdentifierLocation: true }, + { marker: ["2", "3", "4"], includes: { name: "toExponential", kind: "method" } }, + { marker: "5", includes: { name: "test1", kind: "warning" } }, ); diff --git a/tests/cases/fourslash/getJavaScriptCompletions13.ts b/tests/cases/fourslash/getJavaScriptCompletions13.ts index 0fc308eb2d060..8c8b494277982 100644 --- a/tests/cases/fourslash/getJavaScriptCompletions13.ts +++ b/tests/cases/fourslash/getJavaScriptCompletions13.ts @@ -14,6 +14,6 @@ ////file2Identifier2./*2*/ verify.completions( - { at: "1", includes: ["file2Identifier1", "file2Identifier2", "file1Identifier"], excludes: "FooProp" }, - { at: "2", includes: ["file2Identifier1", "file2Identifier2"], excludes: ["file1Identifier", "FooProp"] }, + { marker: "1", includes: ["file2Identifier1", "file2Identifier2", "file1Identifier"], excludes: "FooProp" }, + { marker: "2", includes: ["file2Identifier1", "file2Identifier2"], excludes: ["file1Identifier", "FooProp"] }, ) diff --git a/tests/cases/fourslash/javaScriptClass1.ts b/tests/cases/fourslash/javaScriptClass1.ts index d55db67113e97..fbbb3c4880dc3 100644 --- a/tests/cases/fourslash/javaScriptClass1.ts +++ b/tests/cases/fourslash/javaScriptClass1.ts @@ -19,7 +19,7 @@ goTo.marker(); edit.insert('.'); -verify.completions({ are: ["bar", "thing", "union", "Foo", "x"] }); +verify.completions({ exact: ["bar", "thing", "union", "Foo", "x"] }); edit.insert('bar.'); verify.completions({ includes: ["substr"], isNewIdentifierLocation: true }); diff --git a/tests/cases/fourslash/javaScriptModules12.ts b/tests/cases/fourslash/javaScriptModules12.ts index d6b6ae627036e..5ca58bc4dc76d 100644 --- a/tests/cases/fourslash/javaScriptModules12.ts +++ b/tests/cases/fourslash/javaScriptModules12.ts @@ -27,7 +27,7 @@ //// /*5*/ verify.completions( - { at: "1", includes: ["x", "a", "b"], excludes: "y" }, - { at: "2", includes: ["y", "a", "b"], excludes: "x" }, - { at: ["3", "4", "5"], includes: ["a", "b"], excludes: ["x", "y"] }, + { marker: "1", includes: ["x", "a", "b"], excludes: "y" }, + { marker: "2", includes: ["y", "a", "b"], excludes: "x" }, + { marker: ["3", "4", "5"], includes: ["a", "b"], excludes: ["x", "y"] }, ); diff --git a/tests/cases/fourslash/memberCompletionOnTypeParameters.ts b/tests/cases/fourslash/memberCompletionOnTypeParameters.ts index 0a6f9afa8fed0..a29c1df6f9092 100644 --- a/tests/cases/fourslash/memberCompletionOnTypeParameters.ts +++ b/tests/cases/fourslash/memberCompletionOnTypeParameters.ts @@ -14,7 +14,7 @@ ////} verify.completions( - { at: "S", are: undefined }, - { at: ["T", "V"], are: [{ name: "x", text: "(property) IFoo.x: number" }, { name: "y", text: "(property) IFoo.y: string" }]}, - { at: "U", are: ["constructor", "toString", "toLocaleString", "valueOf", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable"] }, + { marker: "S", exact: undefined }, + { marker: ["T", "V"], exact: [{ name: "x", text: "(property) IFoo.x: number" }, { name: "y", text: "(property) IFoo.y: string" }]}, + { marker: "U", exact: ["constructor", "toString", "toLocaleString", "valueOf", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable"] }, ); diff --git a/tests/cases/fourslash/memberListInsideObjectLiterals.ts b/tests/cases/fourslash/memberListInsideObjectLiterals.ts index a91300cbf5f82..0fc6a0d287f06 100644 --- a/tests/cases/fourslash/memberListInsideObjectLiterals.ts +++ b/tests/cases/fourslash/memberListInsideObjectLiterals.ts @@ -27,6 +27,6 @@ const x1 = { name: "x1", text: "(property) MyPoint.x1: number" }; const y1 = { name: "y1", text: "(property) MyPoint.y1: number" }; verify.completions( - { at: ["1", "3", "4"], are: [x1, y1] }, // Literal member completion inside empty literal or at existing member name location - { at: ["2"], are: y1 }, // Literal member completion for 2nd member name + { marker: ["1", "3", "4"], exact: [x1, y1] }, // Literal member completion inside empty literal or at existing member name location + { marker: ["2"], exact: y1 }, // Literal member completion for 2nd member name ); diff --git a/tests/cases/fourslash/tripleSlashRefPathCompletionExtensionsAllowJSTrue.ts b/tests/cases/fourslash/tripleSlashRefPathCompletionExtensionsAllowJSTrue.ts index ad873e9d509d9..9fe79f5b80ac7 100644 --- a/tests/cases/fourslash/tripleSlashRefPathCompletionExtensionsAllowJSTrue.ts +++ b/tests/cases/fourslash/tripleSlashRefPathCompletionExtensionsAllowJSTrue.ts @@ -24,4 +24,4 @@ // @Filename: f1.cs //// -verify.completions({ at: test.markerNames(), are: ["f1.d.ts", "f1.js", "f1.jsx", "f1.ts", "f1.tsx"], isNewIdentifierLocation: true }); +verify.completions({ marker: test.markerNames(), exact: ["f1.d.ts", "f1.js", "f1.jsx", "f1.ts", "f1.tsx"], isNewIdentifierLocation: true }); diff --git a/tests/cases/fourslash/tsxCompletion14.ts b/tests/cases/fourslash/tsxCompletion14.ts index f28806011aa74..641d2cb824c6a 100644 --- a/tests/cases/fourslash/tsxCompletion14.ts +++ b/tests/cases/fourslash/tsxCompletion14.ts @@ -23,6 +23,6 @@ //// var x4 = ; verify.completions( - { at: ["1", "3"], are: ["ONE", "TWO"] }, - { at: ["2", "4"], are: ["Three", "Four"] }, + { marker: ["1", "3"], exact: ["ONE", "TWO"] }, + { marker: ["2", "4"], exact: ["Three", "Four"] }, ); diff --git a/tests/cases/fourslash/tsxCompletion8.ts b/tests/cases/fourslash/tsxCompletion8.ts index 5f92ea40fb39d..2d6d17d80ccf7 100644 --- a/tests/cases/fourslash/tsxCompletion8.ts +++ b/tests/cases/fourslash/tsxCompletion8.ts @@ -9,4 +9,4 @@ //// } //// var x =
; -verify.completions({ at: ["1", "2"], are: ["ONE", "TWO"] }); +verify.completions({ marker: ["1", "2"], exact: ["ONE", "TWO"] }); diff --git a/tests/cases/fourslash/tsxCompletionNonTagLessThan.ts b/tests/cases/fourslash/tsxCompletionNonTagLessThan.ts index 27e58992f5b9f..8fb1501eb50d8 100644 --- a/tests/cases/fourslash/tsxCompletionNonTagLessThan.ts +++ b/tests/cases/fourslash/tsxCompletionNonTagLessThan.ts @@ -5,7 +5,7 @@ ////[].map Hello world //// -verify.completions({ at: "1", are: ["div"] }, { at: "2", are: ["h1"] }); +verify.completions({ marker: "1", exact: ["div"] }, { marker: "2", exact: ["h1"] }); diff --git a/tests/cases/fourslash/tsxCompletionOnClosingTagWithoutJSX2.ts b/tests/cases/fourslash/tsxCompletionOnClosingTagWithoutJSX2.ts index 66298261160e1..97bfc7da781ea 100644 --- a/tests/cases/fourslash/tsxCompletionOnClosingTagWithoutJSX2.ts +++ b/tests/cases/fourslash/tsxCompletionOnClosingTagWithoutJSX2.ts @@ -5,4 +5,4 @@ ////

Hello world //// -verify.completions({ at: "1", are: ["div"] }, { at: "2", are: ["h1"] }); +verify.completions({ marker: "1", exact: ["div"] }, { marker: "2", exact: ["h1"] });