mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-14 19:16:17 -06:00
Implement feedback on "Improve completions testing" (#23842)
This commit is contained in:
parent
bad3a44bb2
commit
38016f9300
@ -23,7 +23,7 @@
|
||||
namespace FourSlash {
|
||||
ts.disableIncrementalParsing = false;
|
||||
|
||||
import Many = FourSlashInterface.Many;
|
||||
import ArrayOrSingle = FourSlashInterface.Many;
|
||||
|
||||
// Represents a parsed source file with metadata
|
||||
interface FourSlashFile {
|
||||
@ -627,11 +627,11 @@ namespace FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
public verifyGoToDefinitionIs(endMarker: Many<string>) {
|
||||
public verifyGoToDefinitionIs(endMarker: ArrayOrSingle<string>) {
|
||||
this.verifyGoToXWorker(toArray(endMarker), () => this.getGoToDefinition());
|
||||
}
|
||||
|
||||
public verifyGoToDefinition(arg0: any, endMarkerNames?: Many<string>) {
|
||||
public verifyGoToDefinition(arg0: any, endMarkerNames?: ArrayOrSingle<string>) {
|
||||
this.verifyGoToX(arg0, endMarkerNames, () => this.getGoToDefinitionAndBoundSpan());
|
||||
}
|
||||
|
||||
@ -643,23 +643,23 @@ namespace FourSlash {
|
||||
return this.languageService.getDefinitionAndBoundSpan(this.activeFile.fileName, this.currentCaretPosition);
|
||||
}
|
||||
|
||||
public verifyGoToType(arg0: any, endMarkerNames?: Many<string>) {
|
||||
public verifyGoToType(arg0: any, endMarkerNames?: ArrayOrSingle<string>) {
|
||||
this.verifyGoToX(arg0, endMarkerNames, () =>
|
||||
this.languageService.getTypeDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition));
|
||||
}
|
||||
|
||||
private verifyGoToX(arg0: any, endMarkerNames: Many<string> | undefined, getDefs: () => ts.DefinitionInfo[] | ts.DefinitionInfoAndBoundSpan | undefined) {
|
||||
private verifyGoToX(arg0: any, endMarkerNames: ArrayOrSingle<string> | 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<string>, Many<string>]>;
|
||||
const pairs = arg0 as ReadonlyArray<[ArrayOrSingle<string>, ArrayOrSingle<string>]>;
|
||||
for (const [start, end] of pairs) {
|
||||
this.verifyGoToXPlain(start, end, getDefs);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const obj: { [startMarkerName: string]: Many<string> } = arg0;
|
||||
const obj: { [startMarkerName: string]: ArrayOrSingle<string> } = arg0;
|
||||
for (const startMarkerName in obj) {
|
||||
if (ts.hasProperty(obj, startMarkerName)) {
|
||||
this.verifyGoToXPlain(startMarkerName, obj[startMarkerName], getDefs);
|
||||
@ -668,7 +668,7 @@ namespace FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
private verifyGoToXPlain(startMarkerNames: Many<string>, endMarkerNames: Many<string>, getDefs: () => ts.DefinitionInfo[] | ts.DefinitionInfoAndBoundSpan | undefined) {
|
||||
private verifyGoToXPlain(startMarkerNames: ArrayOrSingle<string>, endMarkerNames: ArrayOrSingle<string>, getDefs: () => ts.DefinitionInfo[] | ts.DefinitionInfoAndBoundSpan | undefined) {
|
||||
for (const start of toArray(startMarkerNames)) {
|
||||
this.verifyGoToXSingle(start, endMarkerNames, getDefs);
|
||||
}
|
||||
@ -680,7 +680,7 @@ namespace FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
private verifyGoToXSingle(startMarkerName: string, endMarkerNames: Many<string>, getDefs: () => ReadonlyArray<ts.DefinitionInfo> | ts.DefinitionInfoAndBoundSpan | undefined) {
|
||||
private verifyGoToXSingle(startMarkerName: string, endMarkerNames: ArrayOrSingle<string>, getDefs: () => ReadonlyArray<ts.DefinitionInfo> | ts.DefinitionInfoAndBoundSpan | undefined) {
|
||||
this.goToMarker(startMarkerName);
|
||||
this.verifyGoToXWorker(toArray(endMarkerNames), getDefs, startMarkerName);
|
||||
}
|
||||
@ -843,19 +843,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}'.`);
|
||||
}
|
||||
|
||||
@ -874,9 +876,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) {
|
||||
@ -887,7 +890,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)) {
|
||||
@ -954,7 +957,7 @@ namespace FourSlash {
|
||||
}
|
||||
|
||||
public verifyCompletionsAt(markerName: string | ReadonlyArray<string>, expected: ReadonlyArray<FourSlashInterface.ExpectedCompletionEntry>, 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) {
|
||||
@ -1190,7 +1193,7 @@ namespace FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
public verifyReferenceGroups(starts: Many<string> | Many<Range>, parts: ReadonlyArray<FourSlashInterface.ReferenceGroup> | undefined): void {
|
||||
public verifyReferenceGroups(starts: ArrayOrSingle<string> | ArrayOrSingle<Range>, parts: ReadonlyArray<FourSlashInterface.ReferenceGroup> | undefined): void {
|
||||
interface ReferenceGroupJson {
|
||||
definition: string | { text: string, range: ts.TextSpan };
|
||||
references: ts.ReferenceEntry[];
|
||||
@ -1425,7 +1428,7 @@ Actual: ${stringify(fullActual)}`);
|
||||
}
|
||||
}
|
||||
|
||||
public verifyRenameLocations(startRanges: Many<Range>, options: Range[] | { findInStrings?: boolean, findInComments?: boolean, ranges: Range[] }) {
|
||||
public verifyRenameLocations(startRanges: ArrayOrSingle<Range>, options: Range[] | { findInStrings?: boolean, findInComments?: boolean, ranges: Range[] }) {
|
||||
let findInStrings: boolean, findInComments: boolean, ranges: Range[];
|
||||
if (ts.isArray(options)) {
|
||||
findInStrings = findInComments = false;
|
||||
@ -3815,7 +3818,7 @@ ${code}
|
||||
return ts.arrayFrom(set.keys());
|
||||
}
|
||||
|
||||
function toArray<T>(x: Many<T>): ReadonlyArray<T> {
|
||||
function toArray<T>(x: ArrayOrSingle<T>): ReadonlyArray<T> {
|
||||
return ts.isArray(x) ? x : [x];
|
||||
}
|
||||
|
||||
@ -4763,9 +4766,9 @@ namespace FourSlashInterface {
|
||||
}
|
||||
|
||||
export interface VerifyCompletionsOptions {
|
||||
readonly at?: Many<string>;
|
||||
readonly marker?: Many<string>;
|
||||
readonly isNewIdentifierLocation?: boolean;
|
||||
readonly are?: Many<ExpectedCompletionEntry>;
|
||||
readonly exact?: Many<ExpectedCompletionEntry>;
|
||||
readonly includes?: Many<ExpectedCompletionEntry>;
|
||||
readonly excludes?: Many<string | { readonly name: string, readonly source: string }>;
|
||||
readonly preferences: ts.UserPreferences;
|
||||
|
||||
@ -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' } });
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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<number>");
|
||||
|
||||
verify.completions({ at: "4", includes: "x" });
|
||||
verify.completions({ marker: "4", includes: "x" });
|
||||
edit.insert('x;');
|
||||
|
||||
verify.quickInfoAt("5", "(local var) r2: number");
|
||||
|
||||
@ -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'");
|
||||
@ -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" },
|
||||
],
|
||||
|
||||
@ -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"],
|
||||
|
||||
@ -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 });
|
||||
|
||||
@ -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,
|
||||
},
|
||||
)
|
||||
|
||||
@ -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,
|
||||
});
|
||||
|
||||
@ -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,
|
||||
});
|
||||
|
||||
@ -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,
|
||||
});
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
////
|
||||
|
||||
verify.completions({
|
||||
at: test.markerNames(),
|
||||
are: ["module", "module-from-node"],
|
||||
marker: test.markerNames(),
|
||||
exact: ["module", "module-from-node"],
|
||||
isNewIdentifierLocation: true,
|
||||
});
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
//// export var z = 5;
|
||||
|
||||
verify.completions({
|
||||
at: test.markerNames(),
|
||||
are: ["2test", "prefix", "prefix-only", "0test", "1test"],
|
||||
marker: test.markerNames(),
|
||||
exact: ["2test", "prefix", "prefix-only", "0test", "1test"],
|
||||
isNewIdentifierLocation: true,
|
||||
});
|
||||
|
||||
@ -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 });
|
||||
|
||||
@ -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", "folder", "tests"],
|
||||
marker: kinds.map(k => `${k}2`),
|
||||
exact: ["e1", "f1", "f2", "folder", "tests"],
|
||||
isNewIdentifierLocation: true,
|
||||
});
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
////
|
||||
|
||||
verify.completions({
|
||||
at: test.markerNames(),
|
||||
are: ["module1", "module2", "more", "module0"],
|
||||
marker: test.markerNames(),
|
||||
exact: ["module1", "module2", "more", "module0"],
|
||||
isNewIdentifierLocation: true,
|
||||
});
|
||||
|
||||
@ -4,4 +4,4 @@
|
||||
//// /*1*/
|
||||
////
|
||||
|
||||
verify.completions({ at: "1", includes: ["foo", "x", "y", "z"] });
|
||||
verify.completions({ marker: "1", includes: ["foo", "x", "y", "z"] });
|
||||
|
||||
@ -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"]})
|
||||
|
||||
@ -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"]})
|
||||
|
||||
@ -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"]})
|
||||
|
||||
@ -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"]})
|
||||
|
||||
@ -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"]})
|
||||
|
||||
@ -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"]})
|
||||
|
||||
@ -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 });
|
||||
|
||||
@ -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 });
|
||||
|
||||
@ -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" });
|
||||
|
||||
@ -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" });
|
||||
|
||||
@ -8,4 +8,4 @@
|
||||
//// var v = (p: /*1*/
|
||||
////}
|
||||
|
||||
verify.completions({ at: "1", includes: "MyType" });
|
||||
verify.completions({ marker: "1", includes: "MyType" });
|
||||
|
||||
@ -9,4 +9,4 @@
|
||||
//// }
|
||||
////}
|
||||
|
||||
verify.completions({ at: "1", includes: "MyType" });
|
||||
verify.completions({ marker: "1", includes: "MyType" });
|
||||
|
||||
@ -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"] });
|
||||
|
||||
@ -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"] });
|
||||
|
||||
@ -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"] });
|
||||
|
||||
@ -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"] });
|
||||
|
||||
@ -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"] });
|
||||
|
||||
@ -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"] });
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
////declare function foo<TString, TNumber>(obj: I<TString, TNumber>): { 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.
|
||||
})
|
||||
|
||||
@ -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 },
|
||||
);
|
||||
|
||||
@ -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"],
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
////}
|
||||
|
||||
verify.completions({
|
||||
at: "",
|
||||
marker: "",
|
||||
includes: "publicInstanceMethod",
|
||||
excludes: [
|
||||
"publicProperty",
|
||||
|
||||
@ -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"] },
|
||||
);
|
||||
|
||||
@ -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 },
|
||||
});
|
||||
|
||||
@ -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 },
|
||||
],
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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"],
|
||||
|
||||
@ -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" },
|
||||
|
||||
@ -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 } });
|
||||
|
||||
@ -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 },
|
||||
|
||||
@ -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 },
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
////fo/**/
|
||||
|
||||
verify.completions({
|
||||
at: "",
|
||||
marker: "",
|
||||
includes: "foo",
|
||||
excludes: { name: "foo", source: "/a" },
|
||||
preferences: { includeCompletionsForModuleExports: true },
|
||||
|
||||
@ -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
|
||||
});
|
||||
|
||||
@ -20,18 +20,18 @@
|
||||
////const less = 1 </*lessThan*/
|
||||
|
||||
verify.completions(
|
||||
{ at: "openQuote", are: ["a", "b"], triggerCharacter: '"' },
|
||||
{ at: "closeQuote", are: undefined, triggerCharacter: '"' },
|
||||
{ marker: "openQuote", exact: ["a", "b"], triggerCharacter: '"' },
|
||||
{ marker: "closeQuote", exact: undefined, triggerCharacter: '"' },
|
||||
|
||||
{ at: "openSingleQuote", are: ["a", "b"], triggerCharacter: "'" },
|
||||
{ at: "closeSingleQuote", are: undefined, triggerCharacter: "'" },
|
||||
{ marker: "openSingleQuote", exact: ["a", "b"], triggerCharacter: "'" },
|
||||
{ marker: "closeSingleQuote", exact: undefined, triggerCharacter: "'" },
|
||||
|
||||
{ at: "openTemplate", are: ["a", "b"], triggerCharacter: "`" },
|
||||
{ at: "closeTemplate", are: undefined, triggerCharacter: "`" },
|
||||
{ marker: "openTemplate", exact: ["a", "b"], triggerCharacter: "`" },
|
||||
{ marker: "closeTemplate", exact: undefined, triggerCharacter: "`" },
|
||||
|
||||
{ at: "quoteInComment", are: undefined, triggerCharacter: '"' },
|
||||
{ at: "lessInComment", are: undefined, triggerCharacter: "<" },
|
||||
{ marker: "quoteInComment", exact: undefined, triggerCharacter: '"' },
|
||||
{ marker: "lessInComment", exact: undefined, triggerCharacter: "<" },
|
||||
|
||||
{ at: "openTag", includes: "div", triggerCharacter: "<" },
|
||||
{ at: "lessThan", are: undefined, triggerCharacter: "<" },
|
||||
{ marker: "openTag", includes: "div", triggerCharacter: "<" },
|
||||
{ marker: "lessThan", exact: undefined, triggerCharacter: "<" },
|
||||
);
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
|
||||
const verifyCompletions = () =>
|
||||
verify.completions(
|
||||
{ at: "1", includes: "toFixed" },
|
||||
{ at: "2", are: ["length", "add", "remove"] },
|
||||
{ marker: "1", includes: "toFixed" },
|
||||
{ marker: "2", exact: ["length", "add", "remove"] },
|
||||
);
|
||||
|
||||
verifyCompletions();
|
||||
|
||||
@ -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.
|
||||
|
||||
|
||||
@ -202,15 +202,15 @@ declare namespace FourSlashInterface {
|
||||
assertHasRanges(ranges: Range[]): void;
|
||||
caretAtMarker(markerName?: string): void;
|
||||
completions(...options: {
|
||||
readonly at?: Many<string>,
|
||||
readonly marker?: ArrayOrSingle<string>,
|
||||
readonly isNewIdentifierLocation?: boolean;
|
||||
readonly are?: Many<ExpectedCompletionEntry>;
|
||||
readonly includes?: Many<ExpectedCompletionEntry>;
|
||||
readonly excludes?: Many<string | { name: string, source: string }>;
|
||||
readonly exact?: ArrayOrSingle<ExpectedCompletionEntry>;
|
||||
readonly includes?: ArrayOrSingle<ExpectedCompletionEntry>;
|
||||
readonly excludes?: ArrayOrSingle<string | { name: string, source: string }>;
|
||||
readonly preferences?: UserPreferences;
|
||||
readonly triggerCharacter?: string;
|
||||
}[]): void;
|
||||
completionsAt(markerName: Many<string>, completions: ReadonlyArray<ExpectedCompletionEntry>, options?: CompletionsAtOptions): void;
|
||||
completionsAt(markerName: ArrayOrSingle<string>, completions: ReadonlyArray<ExpectedCompletionEntry>, 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<string>): void;
|
||||
goToDefinitionIs(endMarkers: ArrayOrSingle<string>): 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<string>, endMarkerNames: Many<string>): void;
|
||||
goToDefinition(startMarkerNames: Many<string>, endMarkerNames: Many<string>, range: Range): void;
|
||||
goToDefinition(startMarkerNames: ArrayOrSingle<string>, endMarkerNames: ArrayOrSingle<string>): void;
|
||||
goToDefinition(startMarkerNames: ArrayOrSingle<string>, endMarkerNames: ArrayOrSingle<string>, range: Range): void;
|
||||
/** Performs `goToDefinition` for each pair. */
|
||||
goToDefinition(startsAndEnds: [Many<string>, Many<string>][]): void;
|
||||
goToDefinition(startsAndEnds: [ArrayOrSingle<string>, ArrayOrSingle<string>][]): void;
|
||||
/** Performs `goToDefinition` on each key and value. */
|
||||
goToDefinition(startsAndEnds: { [startMarkerName: string]: Many<string> }): void;
|
||||
goToDefinition(startsAndEnds: { [startMarkerName: string]: ArrayOrSingle<string> }): void;
|
||||
/** Verifies goToDefinition for each `${markerName}Reference` -> `${markerName}Definition` */
|
||||
goToDefinitionForMarkers(...markerNames: string[]): void;
|
||||
goToType(startsAndEnds: { [startMarkerName: string]: Many<string> }): void;
|
||||
goToType(startMarkerNames: Many<string>, endMarkerNames: Many<string>): void;
|
||||
goToType(startsAndEnds: { [startMarkerName: string]: ArrayOrSingle<string> }): void;
|
||||
goToType(startMarkerNames: ArrayOrSingle<string>, endMarkerNames: ArrayOrSingle<string>): 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<string> | Many<Range>, parts: Array<{ definition: ReferencesDefinition, ranges: Range[] }>): void;
|
||||
referenceGroups(starts: ArrayOrSingle<string> | ArrayOrSingle<Range>, 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<Range>, options: Range[] | { findInStrings?: boolean, findInComments?: boolean, ranges: Range[] }): void;
|
||||
renameLocations(startRanges: ArrayOrSingle<Range>, 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> = T | ReadonlyArray<T>;
|
||||
type ArrayOrSingle<T> = T | ReadonlyArray<T>;
|
||||
}
|
||||
declare function verifyOperationIsCancelled(f: any): void;
|
||||
declare var test: FourSlashInterface.test_;
|
||||
|
||||
@ -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" } },
|
||||
);
|
||||
|
||||
@ -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"] },
|
||||
)
|
||||
|
||||
@ -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 });
|
||||
|
||||
@ -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"] },
|
||||
);
|
||||
|
||||
@ -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"] },
|
||||
);
|
||||
|
||||
@ -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
|
||||
);
|
||||
|
||||
@ -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 });
|
||||
|
||||
@ -23,6 +23,6 @@
|
||||
//// var x4 = <Exp.M.SFCComp /*4*/ ></Exp.M.SFCComp>;
|
||||
|
||||
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"] },
|
||||
);
|
||||
|
||||
@ -9,4 +9,4 @@
|
||||
//// }
|
||||
//// var x = <div /*1*/ autoComplete /*2*/ />;
|
||||
|
||||
verify.completions({ at: ["1", "2"], are: ["ONE", "TWO"] });
|
||||
verify.completions({ marker: ["1", "2"], exact: ["ONE", "TWO"] });
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
////[].map<numb/*b*/;
|
||||
////1 < Infini/*c*/;
|
||||
|
||||
verify.completions({ at: "a", includes: "number", excludes: "SVGNumber" })
|
||||
verify.completions({ marker: "a", includes: "number", excludes: "SVGNumber" })
|
||||
for (const marker of ["a", "b"]) {
|
||||
goTo.marker(marker);
|
||||
verify.completionListContains("number");
|
||||
|
||||
@ -11,4 +11,4 @@
|
||||
//// <h1> Hello world </ /*2*/>
|
||||
//// </ /*1*/>
|
||||
|
||||
verify.completions({ at: "1", are: ["div"] }, { at: "2", are: ["h1"] });
|
||||
verify.completions({ marker: "1", exact: ["div"] }, { marker: "2", exact: ["h1"] });
|
||||
|
||||
@ -5,4 +5,4 @@
|
||||
//// <h1> Hello world </ /*2*/>
|
||||
//// </ /*1*/>
|
||||
|
||||
verify.completions({ at: "1", are: ["div"] }, { at: "2", are: ["h1"] });
|
||||
verify.completions({ marker: "1", exact: ["div"] }, { marker: "2", exact: ["h1"] });
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user