mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 21:53:42 -06:00
Simplify go-to-definition tests
This commit is contained in:
parent
3bcfb6ba53
commit
37f8eac014
@ -525,6 +525,56 @@ namespace FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
public verifyGoToDefinitionIs(endMarker: string | string[]) {
|
||||
this.verifyGoToDefinitionWorker(endMarker instanceof Array ? endMarker : [endMarker]);
|
||||
}
|
||||
|
||||
public verifyGoToDefinition(startsAndEnds: (string | string[])[]) {
|
||||
if (startsAndEnds.length % 2) {
|
||||
throw new Error("verify.goToDefinition needs an even number of arguments.");
|
||||
}
|
||||
|
||||
for (let i = 0; i < startsAndEnds.length; i += 2) {
|
||||
const start = startsAndEnds[i];
|
||||
const end = startsAndEnds[i + 1];
|
||||
|
||||
if (start instanceof Array) {
|
||||
for (const s of start) {
|
||||
this.verifyGoToDefinitionSingle(s, end);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.verifyGoToDefinitionSingle(start, end);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public verifyGoToDefinitionForMarkers(markerNames: string[]) {
|
||||
for (const markerName of markerNames) {
|
||||
this.verifyGoToDefinitionSingle(`${markerName}Reference`, `${markerName}Definition`);
|
||||
}
|
||||
}
|
||||
|
||||
private verifyGoToDefinitionSingle(start: string, end: string | string[]) {
|
||||
this.goToMarker(start);
|
||||
this.verifyGoToDefinitionWorker(end instanceof Array ? end : [end]);
|
||||
}
|
||||
|
||||
private verifyGoToDefinitionWorker(endMarkers: string[]) {
|
||||
const definitions = this.languageService.getDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition) || [];
|
||||
|
||||
if (endMarkers.length !== definitions.length) {
|
||||
this.raiseError(`goToDefinitions failed - expected to find ${endMarkers.length} definitions but got ${definitions.length}`);
|
||||
}
|
||||
|
||||
for (let i = 0; i < endMarkers.length; i++) {
|
||||
const marker = this.getMarkerByName(endMarkers[i]), definition = definitions[i];
|
||||
if (marker.fileName !== definition.fileName || marker.position !== definition.textSpan.start) {
|
||||
this.raiseError(`goToDefinition failed for definition ${i}: expected ${marker.fileName} at ${marker.position}, got ${definition.fileName} at ${definition.textSpan.start}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public verifyGetEmitOutputForCurrentFile(expected: string): void {
|
||||
const emit = this.languageService.getEmitOutput(this.activeFile.fileName);
|
||||
if (emit.outputFiles.length !== 1) {
|
||||
@ -1561,21 +1611,6 @@ namespace FourSlash {
|
||||
this.goToPosition(len);
|
||||
}
|
||||
|
||||
public goToDefinition(definitionIndex: number) {
|
||||
const definitions = this.languageService.getDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition);
|
||||
if (!definitions || !definitions.length) {
|
||||
this.raiseError("goToDefinition failed - expected to find at least one definition location but got 0");
|
||||
}
|
||||
|
||||
if (definitionIndex >= definitions.length) {
|
||||
this.raiseError(`goToDefinition failed - definitionIndex value (${definitionIndex}) exceeds definition list size (${definitions.length})`);
|
||||
}
|
||||
|
||||
const definition = definitions[definitionIndex];
|
||||
this.openFile(definition.fileName);
|
||||
this.currentCaretPosition = definition.textSpan.start;
|
||||
}
|
||||
|
||||
public goToTypeDefinition(definitionIndex: number) {
|
||||
const definitions = this.languageService.getTypeDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition);
|
||||
if (!definitions || !definitions.length) {
|
||||
@ -1591,28 +1626,6 @@ namespace FourSlash {
|
||||
this.currentCaretPosition = definition.textSpan.start;
|
||||
}
|
||||
|
||||
public verifyDefinitionLocationExists(negative: boolean) {
|
||||
const definitions = this.languageService.getDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition);
|
||||
|
||||
const foundDefinitions = definitions && definitions.length;
|
||||
|
||||
if (foundDefinitions && negative) {
|
||||
this.raiseError(`goToDefinition - expected to 0 definition locations but got ${definitions.length}`);
|
||||
}
|
||||
else if (!foundDefinitions && !negative) {
|
||||
this.raiseError("goToDefinition - expected to find at least one definition location but got 0");
|
||||
}
|
||||
}
|
||||
|
||||
public verifyDefinitionsCount(negative: boolean, expectedCount: number) {
|
||||
const assertFn = negative ? assert.notEqual : assert.equal;
|
||||
|
||||
const definitions = this.languageService.getDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition);
|
||||
const actualCount = definitions && definitions.length || 0;
|
||||
|
||||
assertFn(actualCount, expectedCount, this.messageAtLastKnownMarker("Definitions Count"));
|
||||
}
|
||||
|
||||
public verifyTypeDefinitionsCount(negative: boolean, expectedCount: number) {
|
||||
const assertFn = negative ? assert.notEqual : assert.equal;
|
||||
|
||||
@ -1622,18 +1635,12 @@ namespace FourSlash {
|
||||
assertFn(actualCount, expectedCount, this.messageAtLastKnownMarker("Type definitions Count"));
|
||||
}
|
||||
|
||||
public verifyDefinitionsName(negative: boolean, expectedName: string, expectedContainerName: string) {
|
||||
public verifyGoToDefinitionName(expectedName: string, expectedContainerName: string) {
|
||||
const definitions = this.languageService.getDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition);
|
||||
const actualDefinitionName = definitions && definitions.length ? definitions[0].name : "";
|
||||
const actualDefinitionContainerName = definitions && definitions.length ? definitions[0].containerName : "";
|
||||
if (negative) {
|
||||
assert.notEqual(actualDefinitionName, expectedName, this.messageAtLastKnownMarker("Definition Info Name"));
|
||||
assert.notEqual(actualDefinitionContainerName, expectedContainerName, this.messageAtLastKnownMarker("Definition Info Container Name"));
|
||||
}
|
||||
else {
|
||||
assert.equal(actualDefinitionName, expectedName, this.messageAtLastKnownMarker("Definition Info Name"));
|
||||
assert.equal(actualDefinitionContainerName, expectedContainerName, this.messageAtLastKnownMarker("Definition Info Container Name"));
|
||||
}
|
||||
assert.equal(actualDefinitionName, expectedName, this.messageAtLastKnownMarker("Definition Info Name"));
|
||||
assert.equal(actualDefinitionContainerName, expectedContainerName, this.messageAtLastKnownMarker("Definition Info Container Name"));
|
||||
}
|
||||
|
||||
public getMarkers(): Marker[] {
|
||||
@ -1641,6 +1648,10 @@ namespace FourSlash {
|
||||
return this.testData.markers.slice(0);
|
||||
}
|
||||
|
||||
public getMarkerNames(): string[] {
|
||||
return Object.keys(this.testData.markerPositions);
|
||||
}
|
||||
|
||||
public getRanges(): Range[] {
|
||||
return this.testData.ranges;
|
||||
}
|
||||
@ -2742,6 +2753,10 @@ namespace FourSlashInterface {
|
||||
return this.state.getMarkers();
|
||||
}
|
||||
|
||||
public markerNames(): string[] {
|
||||
return this.state.getMarkerNames();
|
||||
}
|
||||
|
||||
public marker(name?: string): FourSlash.Marker {
|
||||
return this.state.getMarkerByName(name);
|
||||
}
|
||||
@ -2777,10 +2792,6 @@ namespace FourSlashInterface {
|
||||
this.state.goToEOF();
|
||||
}
|
||||
|
||||
public definition(definitionIndex = 0) {
|
||||
this.state.goToDefinition(definitionIndex);
|
||||
}
|
||||
|
||||
public type(definitionIndex = 0) {
|
||||
this.state.goToTypeDefinition(definitionIndex);
|
||||
}
|
||||
@ -2885,22 +2896,10 @@ namespace FourSlashInterface {
|
||||
this.state.verifyQuickInfoExists(this.negative);
|
||||
}
|
||||
|
||||
public definitionCountIs(expectedCount: number) {
|
||||
this.state.verifyDefinitionsCount(this.negative, expectedCount);
|
||||
}
|
||||
|
||||
public typeDefinitionCountIs(expectedCount: number) {
|
||||
this.state.verifyTypeDefinitionsCount(this.negative, expectedCount);
|
||||
}
|
||||
|
||||
public definitionLocationExists() {
|
||||
this.state.verifyDefinitionLocationExists(this.negative);
|
||||
}
|
||||
|
||||
public verifyDefinitionsName(name: string, containerName: string) {
|
||||
this.state.verifyDefinitionsName(this.negative, name, containerName);
|
||||
}
|
||||
|
||||
public isValidBraceCompletionAtPosition(openingBrace: string) {
|
||||
this.state.verifyBraceCompletionAtPosition(this.negative, openingBrace);
|
||||
}
|
||||
@ -2944,6 +2943,22 @@ namespace FourSlashInterface {
|
||||
this.state.verifyCurrentFileContent(text);
|
||||
}
|
||||
|
||||
public goToDefinitionIs(endMarkers: string | string[]) {
|
||||
this.state.verifyGoToDefinitionIs(endMarkers);
|
||||
}
|
||||
|
||||
public goToDefinition(...startsAndEnds: (string | string[])[]) {
|
||||
this.state.verifyGoToDefinition(startsAndEnds);
|
||||
}
|
||||
|
||||
public goToDefinitionForMarkers(...markerNames: string[]) {
|
||||
this.state.verifyGoToDefinitionForMarkers(markerNames);
|
||||
}
|
||||
|
||||
public goToDefinitionName(name: string, containerName: string) {
|
||||
this.state.verifyGoToDefinitionName(name, containerName);
|
||||
}
|
||||
|
||||
public verifyGetEmitOutputForCurrentFile(expected: string): void {
|
||||
this.state.verifyGetEmitOutputForCurrentFile(expected);
|
||||
}
|
||||
|
||||
@ -12,28 +12,22 @@
|
||||
|
||||
goTo.marker("useFoo");
|
||||
verify.quickInfoIs("import foo");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("importFoo");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("module");
|
||||
verify.goToDefinition(
|
||||
"useFoo", "importFoo",
|
||||
"importFoo", "module");
|
||||
|
||||
goTo.marker("useBar");
|
||||
verify.quickInfoIs("import bar");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("module");
|
||||
verify.goToDefinition("useBar", "module");
|
||||
|
||||
goTo.marker("useBaz");
|
||||
verify.quickInfoIs("import baz");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("importBaz");
|
||||
goTo.marker("idBaz");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("module");
|
||||
verify.goToDefinition(
|
||||
"useBaz", "importBaz",
|
||||
"idBaz", "module");
|
||||
|
||||
goTo.marker("useBang");
|
||||
verify.quickInfoIs("import bang = require(\"jquery\")");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("importBang");
|
||||
goTo.marker("idBang");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("module");
|
||||
verify.goToDefinition(
|
||||
"useBang", "importBang",
|
||||
"idBang", "module");
|
||||
|
||||
@ -7,6 +7,4 @@
|
||||
// @Filename: a.ts
|
||||
//// /*2*/export class Foo {}
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
verify.goToDefinition("1", "2");
|
||||
|
||||
@ -8,4 +8,4 @@
|
||||
////var enumMember = e./*1*/thirdMember;
|
||||
|
||||
goTo.marker("1");
|
||||
verify.verifyDefinitionsName("thirdMember", "e");
|
||||
verify.goToDefinitionName("thirdMember", "e");
|
||||
|
||||
@ -99,6 +99,7 @@ declare namespace FourSlashInterface {
|
||||
}
|
||||
class test_ {
|
||||
markers(): Marker[];
|
||||
markerNames(): string[];
|
||||
marker(name?: string): Marker;
|
||||
ranges(): Range[];
|
||||
rangesByText(): { [text: string]: Range[] };
|
||||
@ -108,7 +109,6 @@ declare namespace FourSlashInterface {
|
||||
marker(name?: string): void;
|
||||
bof(): void;
|
||||
eof(): void;
|
||||
definition(definitionIndex?: number): void;
|
||||
type(definitionIndex?: number): void;
|
||||
position(position: number, fileIndex?: number): any;
|
||||
position(position: number, fileName?: string): any;
|
||||
@ -132,10 +132,7 @@ declare namespace FourSlashInterface {
|
||||
errorExistsBeforeMarker(markerName?: string): void;
|
||||
quickInfoIs(expectedText?: string, expectedDocumentation?: string): void;
|
||||
quickInfoExists(): void;
|
||||
definitionCountIs(expectedCount: number): void;
|
||||
typeDefinitionCountIs(expectedCount: number): void;
|
||||
definitionLocationExists(): void;
|
||||
verifyDefinitionsName(name: string, containerName: string): void;
|
||||
isValidBraceCompletionAtPosition(openingBrace?: string): void;
|
||||
}
|
||||
class verify extends verifyNegatable {
|
||||
@ -152,6 +149,18 @@ declare namespace FourSlashInterface {
|
||||
eval(expr: string, value: any): void;
|
||||
currentLineContentIs(text: string): void;
|
||||
currentFileContentIs(text: string): void;
|
||||
/** Verifies that goToDefinition at the current position would take you to `endMarker`. */
|
||||
goToDefinitionIs(endMarkers: string | 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.
|
||||
* Finally, `verify.goToDefinition("a", "b", "c", "d");` is just `verify.goToDefinition("a", "b"); verify.goToDefinition("c", "d");`.
|
||||
*/
|
||||
goToDefinition(...startsAndEnds: (string | string[])[]): void;
|
||||
/** Verifies goToDefinition for each `${markerName}Reference` -> `${markerName}Definition` */
|
||||
goToDefinitionForMarkers(...markerNames: string[]): void;
|
||||
verifyGetEmitOutputForCurrentFile(expected: string): void;
|
||||
verifyGetEmitOutputContentsForCurrentFile(expected: ts.OutputFile[]): void;
|
||||
/**
|
||||
|
||||
@ -13,10 +13,6 @@
|
||||
//// @/*useDecSymbol*/dec [s]() {}
|
||||
////}
|
||||
|
||||
goTo.marker("useDecString");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("defDecString");
|
||||
|
||||
goTo.marker("useDecSymbol");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("defDecSymbol");
|
||||
verify.goToDefinition(
|
||||
"useDecString", "defDecString",
|
||||
"useDecSymbol", "defDecSymbol");
|
||||
|
||||
@ -1,17 +1,14 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
//@Filename: a.ts
|
||||
////var x: number;
|
||||
////var /*def1*/x: number;
|
||||
|
||||
//@Filename: b.ts
|
||||
////var x: number;
|
||||
////var /*def2*/x: number;
|
||||
|
||||
//@Filename: c.ts
|
||||
/////// <reference path="a.ts" />
|
||||
/////// <reference path="b.ts" />
|
||||
/////**/x++;
|
||||
/////*use*/x++;
|
||||
|
||||
goTo.file("c.ts");
|
||||
goTo.marker();
|
||||
|
||||
verify.definitionCountIs(2);
|
||||
verify.goToDefinition("use", ["def1", "def2"]);
|
||||
|
||||
@ -23,20 +23,6 @@
|
||||
//// x;
|
||||
////}
|
||||
|
||||
|
||||
goTo.marker('alias1Type');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('alias1Definition');
|
||||
|
||||
goTo.marker('alias2Type');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('alias2Definition');
|
||||
|
||||
|
||||
goTo.marker('alias1Value');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('alias1Definition');
|
||||
|
||||
goTo.marker('alias2Value');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('alias2Definition');
|
||||
verify.goToDefinition(
|
||||
["alias1Type", "alias1Value"], "alias1Definition",
|
||||
["alias2Type", "alias2Value"], "alias2Definition");
|
||||
|
||||
@ -14,16 +14,4 @@
|
||||
////ambientClass./*staticMethodReference*/method();
|
||||
////ambientClassVariable./*instanceMethodReference*/method();
|
||||
|
||||
var markerList = [
|
||||
"ambientVariable",
|
||||
"ambientFunction",
|
||||
"constructor",
|
||||
"staticMethod",
|
||||
"instanceMethod",
|
||||
];
|
||||
|
||||
markerList.forEach((marker) => {
|
||||
goTo.marker(marker + 'Reference');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker(marker + 'Definition');
|
||||
});
|
||||
verify.goToDefinitionForMarkers("ambientVariable", "ambientFunction", "constructor", "staticMethod", "instanceMethod");
|
||||
|
||||
@ -8,10 +8,4 @@
|
||||
////o./*reference1*/myObjectMethod();
|
||||
////o["/*reference2*/myObjectMethod"]();
|
||||
|
||||
goTo.marker("reference1");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("definition");
|
||||
|
||||
goTo.marker("reference2");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("definition");
|
||||
verify.goToDefinition(["reference1", "reference2"], "definition");
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
////var b: /*boolean*/boolean;
|
||||
////var v: /*void*/void;
|
||||
|
||||
test.markers().forEach((m, i, a) => {
|
||||
goTo.position(m.position, m.fileName);
|
||||
verify.not.definitionLocationExists();
|
||||
});
|
||||
for (const marker of test.markerNames()) {
|
||||
verify.goToDefinition(marker, []);
|
||||
}
|
||||
|
||||
@ -6,7 +6,6 @@
|
||||
////var t = /*true*/true;
|
||||
////var f = /*false*/false;
|
||||
|
||||
test.markers().forEach((m, i, a) => {
|
||||
goTo.position(m.position, m.fileName);
|
||||
verify.not.definitionLocationExists();
|
||||
});
|
||||
for (const marker of test.markerNames()) {
|
||||
verify.goToDefinition(marker, []);
|
||||
}
|
||||
|
||||
@ -6,6 +6,4 @@
|
||||
//// }
|
||||
////}
|
||||
|
||||
goTo.marker("usage");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("definition");
|
||||
verify.goToDefinition("usage", "definition");
|
||||
|
||||
@ -11,6 +11,4 @@
|
||||
////
|
||||
////var x = new /*usage*/Foo();
|
||||
|
||||
goTo.marker("usage");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("definition");
|
||||
verify.goToDefinition("usage", "definition");
|
||||
|
||||
@ -9,14 +9,7 @@
|
||||
////var constructorOverload = new /*constructorOverloadReference1*/ConstructorOverload();
|
||||
////var constructorOverload = new /*constructorOverloadReference2*/ConstructorOverload("foo");
|
||||
|
||||
goTo.marker('constructorOverloadReference1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('constructorOverload1');
|
||||
|
||||
goTo.marker('constructorOverloadReference2');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('constructorOverload2');
|
||||
|
||||
goTo.marker('constructorOverload1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('constructorDefinition');
|
||||
verify.goToDefinition(
|
||||
"constructorOverloadReference1", "constructorOverload1",
|
||||
"constructorOverloadReference2", "constructorOverload2",
|
||||
"constructorOverload1", "constructorDefinition");
|
||||
|
||||
@ -16,11 +16,6 @@
|
||||
//// return target => target;
|
||||
////}
|
||||
|
||||
|
||||
goTo.marker('decoratorUse');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('decoratorDefinition');
|
||||
|
||||
goTo.marker('decoratorFactoryUse');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('decoratorFactoryDefinition');
|
||||
verify.goToDefinition(
|
||||
"decoratorUse", "decoratorDefinition",
|
||||
"decoratorFactoryUse", "decoratorFactoryDefinition");
|
||||
|
||||
@ -14,16 +14,4 @@
|
||||
////class fooCls implements /*remoteInterfaceReference*/remoteInterface { }
|
||||
////var fooVar = /*remoteModuleReference*/remoteModule.foo;
|
||||
|
||||
var markerList = [
|
||||
"remoteVariable",
|
||||
"remoteFunction",
|
||||
"remoteClass",
|
||||
"remoteInterface",
|
||||
"remoteModule",
|
||||
];
|
||||
|
||||
markerList.forEach((marker) => {
|
||||
goTo.marker(marker + 'Reference');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker(marker + 'Definition');
|
||||
});
|
||||
verify.goToDefinitionForMarkers("remoteVariable", "remoteFunction", "remoteClass", "remoteInterface", "remoteModule");
|
||||
|
||||
@ -21,16 +21,4 @@
|
||||
////class rem2fooCls implements /*remoteInterfaceReference*/rem2Int { }
|
||||
////var rem2fooVar = /*remoteModuleReference*/rem2Mod.foo;
|
||||
|
||||
var markerList = [
|
||||
"remoteVariable",
|
||||
"remoteFunction",
|
||||
"remoteClass",
|
||||
"remoteInterface",
|
||||
"remoteModule",
|
||||
];
|
||||
|
||||
markerList.forEach((marker) => {
|
||||
goTo.marker(marker + 'Reference');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker(marker + 'Definition');
|
||||
});
|
||||
verify.goToDefinitionForMarkers("remoteVariable", "remoteFunction", "remoteClass", "remoteInterface", "remoteModule")
|
||||
|
||||
@ -7,6 +7,4 @@
|
||||
// @Filename: a.ts
|
||||
//// /*2*/export class Foo {}
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
verify.goToDefinition("1", "2");
|
||||
|
||||
@ -8,6 +8,4 @@
|
||||
/////*2*/class Foo {}
|
||||
////export var x = 0;
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
verify.goToDefinition("1", "2");
|
||||
|
||||
@ -9,6 +9,4 @@
|
||||
//// class Foo { }
|
||||
////}
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
verify.goToDefinition("1", "2");
|
||||
|
||||
@ -3,5 +3,4 @@
|
||||
// @Filename: b.ts
|
||||
////import n = require('unknown/*1*/');
|
||||
|
||||
goTo.marker('1');
|
||||
verify.not.definitionLocationExists();
|
||||
verify.goToDefinition("1", []);
|
||||
|
||||
@ -5,6 +5,4 @@
|
||||
//// class Foo { }
|
||||
////}
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
verify.goToDefinition("1", "2");
|
||||
|
||||
@ -8,6 +8,4 @@
|
||||
//// class Foo { }
|
||||
////}
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
verify.goToDefinition("1", "2");
|
||||
|
||||
@ -8,6 +8,4 @@
|
||||
//// class Foo { }
|
||||
////}
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
verify.goToDefinition("1", "2");
|
||||
|
||||
@ -8,6 +8,4 @@
|
||||
//// class Foo { }
|
||||
////}
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
verify.goToDefinition("1", "2");
|
||||
|
||||
@ -8,6 +8,4 @@
|
||||
//// class Foo { }
|
||||
////}
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
verify.goToDefinition("1", "2");
|
||||
|
||||
@ -8,18 +8,8 @@
|
||||
/////*functionOverloadReference2*/functionOverload("123");
|
||||
/////*brokenOverload*/functionOverload({});
|
||||
|
||||
goTo.marker('functionOverloadReference1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('functionOverload1');
|
||||
|
||||
goTo.marker('functionOverloadReference2');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('functionOverload2');
|
||||
|
||||
goTo.marker('brokenOverload');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('functionOverload1');
|
||||
|
||||
goTo.marker('functionOverload');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('functionOverloadDefinition');
|
||||
verify.goToDefinition(
|
||||
"functionOverloadReference1", "functionOverload1",
|
||||
"functionOverloadReference2", "functionOverload2",
|
||||
"brokenOverload", "functionOverload1",
|
||||
"functionOverload", "functionOverloadDefinition");
|
||||
|
||||
@ -11,10 +11,6 @@
|
||||
//// constructor() { }
|
||||
////}
|
||||
|
||||
goTo.marker('staticFunctionOverload');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('staticFunctionOverloadDefinition');
|
||||
|
||||
goTo.marker('functionOverload');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('functionOverloadDefinition');
|
||||
verify.goToDefinition(
|
||||
"staticFunctionOverload", "staticFunctionOverloadDefinition",
|
||||
"functionOverload", "functionOverloadDefinition");
|
||||
|
||||
@ -4,6 +4,4 @@
|
||||
////}
|
||||
////var implicitConstructor = new /*constructorReference*/ImplicitConstructor();
|
||||
|
||||
goTo.marker('constructorReference');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('constructorDefinition');
|
||||
verify.goToDefinitionForMarkers("constructor");
|
||||
|
||||
@ -14,8 +14,5 @@
|
||||
//// x;
|
||||
////}
|
||||
|
||||
goTo.file("b.ts");
|
||||
|
||||
goTo.marker('classAliasDefinition');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('classDefinition');
|
||||
verify.goToDefinition("classAliasDefinition", "classDefinition");
|
||||
|
||||
@ -14,8 +14,4 @@
|
||||
//// x;
|
||||
////}
|
||||
|
||||
goTo.file("b.ts");
|
||||
|
||||
goTo.marker('classAliasDefinition');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('classDefinition');
|
||||
verify.goToDefinition("classAliasDefinition", "classDefinition");
|
||||
|
||||
@ -27,12 +27,4 @@
|
||||
//// x;
|
||||
////}
|
||||
|
||||
goTo.file("e.ts");
|
||||
|
||||
goTo.marker('classReference');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('classDefinition');
|
||||
|
||||
goTo.marker('classAliasDefinition');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('classDefinition');
|
||||
verify.goToDefinition(["classReference", "classAliasDefinition"], "classDefinition");
|
||||
|
||||
@ -14,8 +14,4 @@
|
||||
//// x;
|
||||
////}
|
||||
|
||||
goTo.file("b.ts");
|
||||
|
||||
goTo.marker('classAliasDefinition');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('classDefinition');
|
||||
verify.goToDefinition("classAliasDefinition", "classDefinition");
|
||||
|
||||
@ -14,8 +14,4 @@
|
||||
//// x;
|
||||
////}
|
||||
|
||||
goTo.file("b.ts");
|
||||
|
||||
goTo.marker('classAliasDefinition');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('classDefinition');
|
||||
verify.goToDefinition("classAliasDefinition", "classDefinition");
|
||||
|
||||
@ -14,8 +14,4 @@
|
||||
//// x;
|
||||
////}
|
||||
|
||||
goTo.file("b.ts");
|
||||
|
||||
goTo.marker('moduleAliasDefinition');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('moduleDefinition');
|
||||
verify.goToDefinition("moduleAliasDefinition", "moduleDefinition");
|
||||
|
||||
@ -10,8 +10,4 @@
|
||||
////}
|
||||
////export default Class;
|
||||
|
||||
goTo.file("b.ts");
|
||||
|
||||
goTo.marker('classAliasDefinition');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('classDefinition');
|
||||
verify.goToDefinition("classAliasDefinition", "classDefinition");
|
||||
|
||||
@ -19,35 +19,8 @@
|
||||
//// }
|
||||
////}
|
||||
|
||||
|
||||
goTo.marker("interfaceReference");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("interfaceDefinition");
|
||||
|
||||
goTo.marker("interfaceReferenceInList");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("interfaceDefinition");
|
||||
|
||||
goTo.marker("interfaceReferenceInConstructor");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("interfaceDefinition");
|
||||
|
||||
goTo.marker("classReference");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("classDefinition");
|
||||
|
||||
goTo.marker("classReferenceInInitializer");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("classDefinition");
|
||||
|
||||
goTo.marker("enumReference");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("enumDefinition");
|
||||
|
||||
goTo.marker("enumReferenceInInitializer");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("enumDefinition");
|
||||
|
||||
goTo.marker("selfReference");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("selfDefinition");
|
||||
verify.goToDefinition(
|
||||
["interfaceReference", "interfaceReferenceInList", "interfaceReferenceInConstructor"], "interfaceDefinition",
|
||||
["classReference", "classReferenceInInitializer"], "classDefinition",
|
||||
["enumReference", "enumReferenceInInitializer"], "enumDefinition",
|
||||
"selfReference", "selfDefinition");
|
||||
|
||||
@ -6,11 +6,4 @@
|
||||
////
|
||||
////var x = new Fo/*fooReference*/o<Ba/*barReference*/r>();
|
||||
|
||||
|
||||
goTo.marker("barReference");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("barDefinition");
|
||||
|
||||
goTo.marker("fooReference");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("fooDefinition");
|
||||
verify.goToDefinitionForMarkers("bar", "foo");
|
||||
|
||||
@ -11,6 +11,4 @@
|
||||
//// }
|
||||
////}
|
||||
|
||||
goTo.marker('interfaceReference');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('interfaceDefinition');
|
||||
verify.goToDefinitionForMarkers("interface");
|
||||
|
||||
@ -9,19 +9,10 @@
|
||||
//// }
|
||||
////}
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('label1Definition');
|
||||
|
||||
goTo.marker('2');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('label2Definition');
|
||||
|
||||
// labels accross function bounderies
|
||||
goTo.marker('3');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('label1Definition');
|
||||
|
||||
// undefined label
|
||||
goTo.marker('4');
|
||||
verify.not.definitionLocationExists();
|
||||
verify.goToDefinition(
|
||||
"1", "label1Definition",
|
||||
"2", "label2Definition",
|
||||
// labels accross function boundaries
|
||||
"3", "label1Definition",
|
||||
// undefined label
|
||||
"4", []);
|
||||
|
||||
@ -18,27 +18,10 @@
|
||||
////methodOverload./*instanceMethodReference1*/method();
|
||||
////methodOverload./*instanceMethodReference2*/method("456");
|
||||
|
||||
goTo.marker('staticMethodReference1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('staticMethodOverload1');
|
||||
|
||||
goTo.marker('staticMethodReference2');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('staticMethodOverload2');
|
||||
|
||||
goTo.marker('instanceMethodReference1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('instanceMethodOverload1');
|
||||
|
||||
goTo.marker('instanceMethodReference2');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('instanceMethodOverload2');
|
||||
|
||||
goTo.marker('staticMethodOverload1Name');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('staticMethodDefinition');
|
||||
|
||||
goTo.marker('instanceMethodOverload1Name');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('instanceMethodDefinition');
|
||||
|
||||
verify.goToDefinition(
|
||||
"staticMethodReference1", "staticMethodOverload1",
|
||||
"staticMethodReference2", "staticMethodOverload2",
|
||||
"instanceMethodReference1", "instanceMethodOverload1",
|
||||
"instanceMethodReference2", "instanceMethodOverload2",
|
||||
"staticMethodOverload1Name", "staticMethodDefinition",
|
||||
"instanceMethodOverload1Name", "instanceMethodDefinition");
|
||||
|
||||
@ -1,51 +1,34 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: a.ts
|
||||
/////*interfaceDefintion1*/interface IFoo {
|
||||
/////*interfaceDefinition1*/interface IFoo {
|
||||
//// instance1: number;
|
||||
////}
|
||||
|
||||
// @Filename: b.ts
|
||||
/////*interfaceDefintion2*/interface IFoo {
|
||||
/////*interfaceDefinition2*/interface IFoo {
|
||||
//// instance2: number;
|
||||
////}
|
||||
////
|
||||
/////*interfaceDefintion3*/interface IFoo {
|
||||
/////*interfaceDefinition3*/interface IFoo {
|
||||
//// instance3: number;
|
||||
////}
|
||||
////
|
||||
////var ifoo: IFo/*interfaceReference*/o;
|
||||
|
||||
goTo.marker('interfaceReference');
|
||||
goTo.definition(0);
|
||||
verify.caretAtMarker('interfaceDefintion1');
|
||||
|
||||
goTo.marker('interfaceReference');
|
||||
goTo.definition(1);
|
||||
verify.caretAtMarker('interfaceDefintion2');
|
||||
|
||||
goTo.marker('interfaceReference');
|
||||
goTo.definition(2);
|
||||
verify.caretAtMarker('interfaceDefintion3');
|
||||
|
||||
verify.goToDefinition("interfaceReference", ["interfaceDefinition1", "interfaceDefinition2", "interfaceDefinition3"]);
|
||||
|
||||
// @Filename: c.ts
|
||||
/////*moduleDefintion1*/module Module {
|
||||
/////*moduleDefinition1*/module Module {
|
||||
//// export class c1 { }
|
||||
////}
|
||||
|
||||
// @Filename: d.ts
|
||||
/////*moduleDefintion2*/module Module {
|
||||
/////*moduleDefinition2*/module Module {
|
||||
//// export class c2 { }
|
||||
////}
|
||||
|
||||
// @Filename: e.ts
|
||||
////Modul/*moduleReference*/e;
|
||||
|
||||
goTo.marker('moduleReference');
|
||||
goTo.definition(0);
|
||||
verify.caretAtMarker('moduleDefintion1');
|
||||
|
||||
goTo.marker('moduleReference');
|
||||
goTo.definition(1);
|
||||
verify.caretAtMarker('moduleDefintion2');
|
||||
verify.goToDefinition("moduleReference", ["moduleDefinition1", "moduleDefinition2"]);
|
||||
|
||||
@ -8,7 +8,4 @@
|
||||
////var foo: I;
|
||||
////var { /*use*/property1: prop1 } = foo;
|
||||
|
||||
goTo.marker("use");
|
||||
verify.definitionLocationExists();
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("def");
|
||||
verify.goToDefinition("use", "def");
|
||||
|
||||
@ -14,16 +14,4 @@
|
||||
////o./*methodReference*/method;
|
||||
////o./*es6StyleMethodReference*/es6StyleMethod;
|
||||
|
||||
var markerList = [
|
||||
"value",
|
||||
"getter",
|
||||
"setter",
|
||||
"method",
|
||||
"es6StyleMethod",
|
||||
];
|
||||
|
||||
markerList.forEach((marker) => {
|
||||
goTo.marker(marker + 'Reference');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker(marker + 'Definition');
|
||||
});
|
||||
verify.goToDefinitionForMarkers("value", "getter", "setter", "method", "es6StyleMethod");
|
||||
|
||||
@ -11,6 +11,4 @@
|
||||
////}
|
||||
////A.B./*2*/f("");
|
||||
|
||||
goTo.marker("2");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("1");
|
||||
verify.goToDefinition("2", "1");
|
||||
|
||||
@ -9,13 +9,11 @@
|
||||
|
||||
// @Filename: goToDefinitionPartialImplementation_2.ts
|
||||
////module A {
|
||||
//// export interface IA {
|
||||
//// /*Part2Definition*/export interface IA {
|
||||
//// x: number;
|
||||
//// }
|
||||
////
|
||||
//// var x: /*Part2Use*/IA;
|
||||
////}
|
||||
|
||||
goTo.marker('Part2Use');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('Part1Definition');
|
||||
verify.goToDefinition("Part2Use", ["Part1Definition", "Part2Definition"]);
|
||||
|
||||
@ -2,7 +2,4 @@
|
||||
|
||||
////var x: st/*primitive*/ring;
|
||||
|
||||
goTo.marker("primitive");
|
||||
verify.not.definitionLocationExists();
|
||||
|
||||
|
||||
verify.goToDefinition("primitive", []);
|
||||
|
||||
@ -13,16 +13,4 @@
|
||||
////class fooCls implements /*localInterfaceReference*/localInterface { }
|
||||
////var fooVar = /*localModuleReference*/localModule.foo;
|
||||
|
||||
var markerList = [
|
||||
"localVariable",
|
||||
"localFunction",
|
||||
"localClass",
|
||||
"localInterface",
|
||||
"localModule",
|
||||
];
|
||||
|
||||
markerList.forEach((marker) => {
|
||||
goTo.marker(marker + 'Reference');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker(marker + 'Definition');
|
||||
});
|
||||
verify.goToDefinitionForMarkers("localVariable", "localFunction", "localClass", "localInterface", "localModule");
|
||||
|
||||
@ -6,6 +6,4 @@
|
||||
//// /*shadowVariableReference*/shadowVariable = 1;
|
||||
////}
|
||||
|
||||
goTo.marker('shadowVariableReference');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('shadowVariableDefinition');
|
||||
verify.goToDefinitionForMarkers("shadowVariable");
|
||||
|
||||
@ -5,6 +5,4 @@
|
||||
//// /*shadowVariableReference*/shdVar = 1;
|
||||
////}
|
||||
|
||||
goTo.marker('shadowVariableReference');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('shadowVariableDefinition');
|
||||
verify.goToDefinitionForMarkers("shadowVariable");
|
||||
|
||||
@ -7,19 +7,8 @@
|
||||
//// obj./*valueReference1*/name;
|
||||
//// obj./*valueReference2*/id;
|
||||
|
||||
goTo.marker("valueDefinition1");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("valueDeclaration1");
|
||||
|
||||
goTo.marker("valueDefinition2");
|
||||
goTo.definition(0);
|
||||
verify.caretAtMarker("valueDeclaration2");
|
||||
goTo.definition(1);
|
||||
verify.caretAtMarker("valueDeclaration3");
|
||||
|
||||
goTo.marker("valueReference1");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("valueDefinition1");
|
||||
goTo.marker("valueReference2");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("valueDefinition2");
|
||||
verify.goToDefinition(
|
||||
"valueDefinition1", "valueDeclaration1",
|
||||
"valueDefinition2", ["valueDeclaration2", "valueDeclaration3"],
|
||||
"valueReference1", "valueDefinition1",
|
||||
"valueReference2", "valueDefinition2");
|
||||
|
||||
@ -4,5 +4,4 @@
|
||||
//// f/*1*/oo
|
||||
////}
|
||||
|
||||
goTo.marker("1");
|
||||
verify.not.definitionLocationExists();
|
||||
verify.goToDefinition("1", []);
|
||||
|
||||
@ -7,10 +7,6 @@
|
||||
//// /*letProp*/y
|
||||
////}
|
||||
|
||||
goTo.marker("varProp");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("varDef");
|
||||
|
||||
goTo.marker("letProp");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("letDef");
|
||||
verify.goToDefinition(
|
||||
"varProp", "varDef",
|
||||
"letProp", "letDef");
|
||||
|
||||
@ -7,10 +7,4 @@
|
||||
//// var n = new /*1*/c();
|
||||
//// var n = new c/*3*/();
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
|
||||
goTo.marker('3');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
verify.goToDefinition(["1", "3"], "2");
|
||||
|
||||
@ -16,9 +16,6 @@
|
||||
// @Filename: b.ts
|
||||
/////*fileB*/
|
||||
|
||||
goTo.marker("unknownFile");
|
||||
verify.not.definitionLocationExists();
|
||||
|
||||
goTo.marker("knownFile");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('fileB');
|
||||
verify.goToDefinition(
|
||||
"unknownFile", [],
|
||||
"knownFile", "fileB");
|
||||
|
||||
@ -7,10 +7,6 @@
|
||||
/////*useFNumber*/f`${0}`;
|
||||
/////*useFBool*/f`${false}`;
|
||||
|
||||
goTo.marker("useFNumber");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("defFNumber");
|
||||
|
||||
goTo.marker("useFBool");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("defFBool");
|
||||
verify.goToDefinition(
|
||||
"useFNumber", "defFNumber",
|
||||
"useFBool", "defFBool");
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
// @noLib: true
|
||||
////function f(/*fnDecl*/this: number) {
|
||||
//// return /*fnUse*/this;
|
||||
////}
|
||||
@ -9,12 +8,7 @@
|
||||
//// get self(/*getterDecl*/this: number) { return /*getterUse*/this; }
|
||||
////}
|
||||
|
||||
function verifyDefinition(a, b) {
|
||||
goTo.marker(a);
|
||||
goTo.definition();
|
||||
verify.caretAtMarker(b);
|
||||
}
|
||||
|
||||
verifyDefinition("fnUse", "fnDecl");
|
||||
verifyDefinition("clsUse", "cls");
|
||||
verifyDefinition("getterUse", "getterDecl");
|
||||
verify.goToDefinition(
|
||||
"fnUse", "fnDecl",
|
||||
"clsUse", "cls",
|
||||
"getterUse", "getterDecl");
|
||||
|
||||
@ -5,12 +5,6 @@
|
||||
//// return typeof parameter === "string";
|
||||
//// }
|
||||
|
||||
goTo.marker('parameterName');
|
||||
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('parameterDeclaration');
|
||||
|
||||
goTo.marker('typeReference');
|
||||
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('classDeclaration');
|
||||
verify.goToDefinition(
|
||||
"parameterName", "parameterDeclaration",
|
||||
"typeReference", "classDeclaration");
|
||||
|
||||
@ -8,6 +8,4 @@
|
||||
//// /// <reference types="lib/*1*/"/>
|
||||
//// $.x;
|
||||
|
||||
goTo.marker("1");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("0");
|
||||
verify.goToDefinition("1", "0");
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
////var x = {}; x.some/*undefinedProperty*/Property;
|
||||
////var a: any; a.some/*unkownProperty*/Property;
|
||||
|
||||
test.markers().forEach((m, i, a) => {
|
||||
goTo.position(m.position, m.fileName);
|
||||
verify.not.definitionLocationExists();
|
||||
});
|
||||
for (const marker of test.markerNames()) {
|
||||
verify.goToDefinition(marker, []);
|
||||
}
|
||||
|
||||
@ -15,12 +15,4 @@
|
||||
////x./*propertyReference*/commonProperty;
|
||||
////x./*3*/commonFunction;
|
||||
|
||||
|
||||
goTo.marker("propertyReference");
|
||||
verify.definitionCountIs(2);
|
||||
goTo.definition(0);
|
||||
verify.caretAtMarker("propertyDefinition1");
|
||||
|
||||
goTo.marker("propertyReference");
|
||||
goTo.definition(1);
|
||||
verify.caretAtMarker("propertyDefinition2");
|
||||
verify.goToDefinition("propertyReference", ["propertyDefinition1", "propertyDefinition2"]);
|
||||
|
||||
@ -16,11 +16,4 @@
|
||||
////
|
||||
////x.common./*propertyReference*/a;
|
||||
|
||||
goTo.marker("propertyReference");
|
||||
verify.definitionCountIs(2);
|
||||
goTo.definition(0);
|
||||
verify.caretAtMarker("propertyDefinition2");
|
||||
|
||||
goTo.marker("propertyReference");
|
||||
goTo.definition(1);
|
||||
verify.caretAtMarker("propertyDefinition1");
|
||||
verify.goToDefinition("propertyReference", ["propertyDefinition2", "propertyDefinition1"]);
|
||||
|
||||
@ -9,7 +9,4 @@
|
||||
////
|
||||
////var x = (strings || numbers)./*usage*/specialPop()
|
||||
|
||||
goTo.marker("usage");
|
||||
verify.definitionCountIs(1);
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("definition");
|
||||
verify.goToDefinition("usage", "definition");
|
||||
|
||||
@ -18,15 +18,4 @@
|
||||
////
|
||||
////var x = (snapcrackle || magnitude || art)./*usage*/pop;
|
||||
|
||||
goTo.marker("usage");
|
||||
verify.definitionCountIs(3);
|
||||
goTo.definition(0);
|
||||
verify.caretAtMarker("def1");
|
||||
|
||||
goTo.marker("usage");
|
||||
goTo.definition(1);
|
||||
verify.caretAtMarker("def2");
|
||||
|
||||
goTo.marker("usage");
|
||||
goTo.definition(2);
|
||||
verify.caretAtMarker("def3");
|
||||
verify.goToDefinition("usage", ["def1", "def2", "def3"]);
|
||||
|
||||
@ -19,15 +19,10 @@
|
||||
//// }
|
||||
////}
|
||||
|
||||
// Super in call position goes to constructor.
|
||||
goTo.marker("super");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("ctr");
|
||||
|
||||
// Super in any other position goes to the superclass.
|
||||
goTo.marker("superExpression");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("B");
|
||||
|
||||
goTo.marker("superBroken");
|
||||
verify.definitionCountIs(0);
|
||||
verify.goToDefinition(
|
||||
// Super in call position goes to constructor.
|
||||
"super", "ctr",
|
||||
// Super in any other position goes to the superclass.
|
||||
"superExpression", "B",
|
||||
"superBroken", []);
|
||||
|
||||
@ -7,7 +7,6 @@
|
||||
//// /*3*/import n = require('a');
|
||||
//// var x = new /*1*/n.Foo();
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
// Won't-fixed: Should go to '2' instead
|
||||
verify.caretAtMarker('3');
|
||||
verify.goToDefinition("1", "3");
|
||||
goTo.marker('1');
|
||||
|
||||
@ -6,6 +6,5 @@
|
||||
|
||||
goTo.marker();
|
||||
verify.quickInfoIs("");
|
||||
verify.verifyDefinitionsName("", "");
|
||||
verify.typeDefinitionCountIs(0);
|
||||
verify.goToDefinitionIs([]);
|
||||
verify.referencesAre([]);
|
||||
|
||||
@ -15,10 +15,6 @@
|
||||
//// x.alpha/*src1*/;
|
||||
//// x.beta/*src2*/;
|
||||
|
||||
goTo.marker('src1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('dst1');
|
||||
|
||||
goTo.marker('src2');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('dst2');
|
||||
verify.goToDefinition(
|
||||
"src1", "dst1",
|
||||
"src2", "dst2");
|
||||
|
||||
@ -17,9 +17,7 @@
|
||||
//// var [|/*dst*/nn|]: {name?: string; size?: number};
|
||||
//// var x = <MyClass {...[|n/*src*/n|]}></MyClass>;
|
||||
|
||||
goTo.marker('src');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('dst');
|
||||
verify.goToDefinition("src", "dst");
|
||||
|
||||
goTo.marker('src');
|
||||
verify.renameLocations(/*findInStrings*/ false, /*findInComments*/ false);
|
||||
|
||||
@ -14,7 +14,6 @@ verify.quickInfoIs("var __proto__: M.__proto__", "");
|
||||
goTo.marker('3');
|
||||
verify.completionListContains("__proto__", "var __proto__: M.__proto__", "");
|
||||
edit.insert("__proto__");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
verify.goToDefinitionIs("2");
|
||||
goTo.marker('4');
|
||||
verify.quickInfoIs("var fun: (__proto__: any) => boolean", "");
|
||||
|
||||
@ -21,6 +21,4 @@ verify.occurrencesAtPositionContains(def);
|
||||
verify.occurrencesAtPositionContains(imp);
|
||||
verify.occurrencesAtPositionContains(mem);
|
||||
|
||||
goTo.definition();
|
||||
|
||||
verify.caretAtMarker('def');
|
||||
verify.goToDefinitionIs("def");
|
||||
|
||||
@ -26,13 +26,11 @@ verify.navigationItemsListContains("foo", "const", "foo", "exact");
|
||||
|
||||
goTo.marker("foo_value");
|
||||
verify.quickInfoIs("const foo: number");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("foo_value_declaration");
|
||||
verify.goToDefinitionIs("foo_value_declaration");
|
||||
|
||||
goTo.marker("foo_type");
|
||||
verify.quickInfoIs("import foo = require(\"foo_module\")");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("foo_type_declaration");
|
||||
verify.goToDefinitionIs("foo_type_declaration");
|
||||
|
||||
|
||||
// Above tested for global const and imported interface. Now test with global interface and imported const.
|
||||
@ -58,10 +56,8 @@ verify.navigationItemsListContains("bar", "interface", "bar", "exact");
|
||||
|
||||
goTo.marker("bar_value");
|
||||
verify.quickInfoIs("import bar = require(\"bar_module\")");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("bar_value_declaration");
|
||||
verify.goToDefinitionIs("bar_value_declaration");
|
||||
|
||||
goTo.marker("bar_type");
|
||||
verify.quickInfoIs("interface bar");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("bar_type_declaration");
|
||||
verify.goToDefinitionIs("bar_type_declaration");
|
||||
|
||||
@ -7,6 +7,4 @@
|
||||
// @Filename: a.ts
|
||||
//// /*2*/export class Foo {}
|
||||
|
||||
goTo.marker('1');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
verify.goToDefinition("1", "2");
|
||||
|
||||
@ -19,11 +19,6 @@
|
||||
//// /** @type {Animal} */
|
||||
//// var animal; animal.animalName/*4*/
|
||||
|
||||
goTo.file('jsdocCompletion_typedef.js');
|
||||
goTo.marker('3');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('1');
|
||||
|
||||
goTo.marker('4');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('2');
|
||||
verify.goToDefinition(
|
||||
"3", "1",
|
||||
"4", "2");
|
||||
|
||||
@ -14,16 +14,4 @@
|
||||
////class fooCls implements /*remoteInterfaceReference*/remoteInterface { }
|
||||
////var fooVar = /*remoteModuleReference*/remoteModule.foo;
|
||||
|
||||
var markerList = [
|
||||
"remoteVariable",
|
||||
"remoteFunction",
|
||||
"remoteClass",
|
||||
"remoteInterface",
|
||||
"remoteModule",
|
||||
];
|
||||
|
||||
markerList.forEach((marker) => {
|
||||
goTo.marker(marker + 'Reference');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker(marker + 'Definition');
|
||||
});
|
||||
verify.goToDefinitionForMarkers("remoteVariable", "remoteFunction", "remoteClass", "remoteInterface", "remoteModule");
|
||||
|
||||
@ -8,6 +8,4 @@
|
||||
//// /// <reference types="lib/*1*/"/>
|
||||
//// $.x;
|
||||
|
||||
goTo.marker("1");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("0");
|
||||
verify.goToDefinition("1", "0");
|
||||
|
||||
@ -14,16 +14,4 @@
|
||||
////class fooCls implements /*remoteInterfaceReference*/remoteInterface { }
|
||||
////var fooVar = /*remoteModuleReference*/remoteModule.foo;
|
||||
|
||||
var markerList = [
|
||||
"remoteVariable",
|
||||
"remoteFunction",
|
||||
"remoteClass",
|
||||
"remoteInterface",
|
||||
"remoteModule",
|
||||
];
|
||||
|
||||
markerList.forEach((marker) => {
|
||||
goTo.marker(marker + 'Reference');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker(marker + 'Definition');
|
||||
});
|
||||
verify.goToDefinitionForMarkers("remoteVariable", "remoteFunction", "remoteClass", "remoteInterface", "remoteModule");
|
||||
|
||||
@ -8,6 +8,4 @@
|
||||
//// /// <reference types="lib/*1*/"/>
|
||||
//// $.x;
|
||||
|
||||
goTo.marker("1");
|
||||
goTo.definition();
|
||||
verify.caretAtMarker("0");
|
||||
verify.goToDefinition("1", "0");
|
||||
|
||||
@ -14,10 +14,6 @@
|
||||
//// var x = <My/*c*/Class />;
|
||||
//// var y = <MyClass f/*p*/oo= 'hello' />;
|
||||
|
||||
goTo.marker('c');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('ct');
|
||||
|
||||
goTo.marker('p');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('pt');
|
||||
verify.goToDefinition(
|
||||
"c", "ct",
|
||||
"p", "pt");
|
||||
|
||||
@ -15,15 +15,7 @@
|
||||
//// var y = <s/*ss*/pan />;
|
||||
//// var z = <div na/*ps*/me='hello' />;
|
||||
|
||||
goTo.marker('ds');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('dt');
|
||||
|
||||
goTo.marker('ss');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('st');
|
||||
|
||||
goTo.marker('ps');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('pt');
|
||||
|
||||
verify.goToDefinition(
|
||||
"ds", "dt",
|
||||
"ss", "st",
|
||||
"ps", "pt");
|
||||
|
||||
@ -9,6 +9,4 @@
|
||||
//// }
|
||||
//// }
|
||||
|
||||
goTo.marker('ref');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('def');
|
||||
verify.goToDefinition("ref", "def");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user