Skip to content

Commit 4a37fd7

Browse files
committed
More PR feedback
1 parent f91a123 commit 4a37fd7

File tree

51 files changed

+192
-225
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+192
-225
lines changed

src/harness/fourslash.ts

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,13 +1680,13 @@ namespace FourSlash {
16801680
assertFn(actualCount, expectedCount, this.messageAtLastKnownMarker("Type definitions Count"));
16811681
}
16821682

1683-
public verifyImplementationsCount(negative: boolean, expectedCount: number) {
1683+
public verifyImplementationListIsEmpty(negative: boolean) {
16841684
const assertFn = negative ? assert.notEqual : assert.equal;
16851685

16861686
const implementations = this.languageService.getImplementationAtPosition(this.activeFile.fileName, this.currentCaretPosition);
16871687
const actualCount = implementations && implementations.length || 0;
16881688

1689-
assertFn(actualCount, expectedCount, this.messageAtLastKnownMarker("Implementations Count"));
1689+
assertFn(actualCount, 0, this.messageAtLastKnownMarker("Implementations Count"));
16901690
}
16911691

16921692
public verifyGoToDefinitionName(expectedName: string, expectedContainerName: string) {
@@ -1697,26 +1697,22 @@ namespace FourSlash {
16971697
assert.equal(actualDefinitionContainerName, expectedContainerName, this.messageAtLastKnownMarker("Definition Info Container Name"));
16981698
}
16991699

1700-
public goToImplementation(implIndex?: number) {
1700+
public goToImplementation() {
17011701
const implementations = this.languageService.getImplementationAtPosition(this.activeFile.fileName, this.currentCaretPosition);
17021702
if (!implementations || !implementations.length) {
17031703
this.raiseError("goToImplementation failed - expected to find at least one implementation location but got 0");
17041704
}
1705-
1706-
if (implIndex === undefined && implementations.length > 1) {
1707-
this.raiseError(`goToImplementation failed - no index given but more than 1 implementation returned (${implementations.length})`);
1708-
}
1709-
1710-
if (implIndex >= implementations.length) {
1711-
this.raiseError(`goToImplementation failed - implIndex value (${implIndex}) exceeds implementation list size (${implementations.length})`);
1705+
if (implementations.length > 1) {
1706+
this.raiseError(`goToImplementation failed - more than 1 implementation returned (${implementations.length})`);
17121707
}
17131708

1714-
const implementation = implementations[implIndex || 0];
1709+
const implementation = implementations[0];
17151710
this.openFile(implementation.fileName);
17161711
this.currentCaretPosition = implementation.textSpan.start;
17171712
}
17181713

1719-
public verifyRangesInImplementationList() {
1714+
public verifyRangesInImplementationList(markerName: string) {
1715+
this.goToMarker(markerName);
17201716
const implementations: ImplementationLocationInformation[] = this.languageService.getImplementationAtPosition(this.activeFile.fileName, this.currentCaretPosition);
17211717
if (!implementations || !implementations.length) {
17221718
this.raiseError("verifyRangesInImplementationList failed - expected to find at least one implementation location but got 0");
@@ -2954,8 +2950,8 @@ namespace FourSlashInterface {
29542950
this.state.goToTypeDefinition(definitionIndex);
29552951
}
29562952

2957-
public implementation(implementationIndex?: number) {
2958-
this.state.goToImplementation(implementationIndex);
2953+
public implementation() {
2954+
this.state.goToImplementation();
29592955
}
29602956

29612957
public position(position: number, fileIndex?: number): void;
@@ -3062,8 +3058,8 @@ namespace FourSlashInterface {
30623058
this.state.verifyTypeDefinitionsCount(this.negative, expectedCount);
30633059
}
30643060

3065-
public implementationCountIs(expectedCount: number) {
3066-
this.state.verifyImplementationsCount(this.negative, expectedCount);
3061+
public implementationListIsEmpty() {
3062+
this.state.verifyImplementationListIsEmpty(this.negative);
30673063
}
30683064

30693065
public isValidBraceCompletionAtPosition(openingBrace: string) {
@@ -3319,8 +3315,8 @@ namespace FourSlashInterface {
33193315
this.state.verifyProjectInfo(expected);
33203316
}
33213317

3322-
public allRangesAppearInImplementationList() {
3323-
this.state.verifyRangesInImplementationList();
3318+
public allRangesAppearInImplementationList(markerName: string) {
3319+
this.state.verifyRangesInImplementationList(markerName);
33243320
}
33253321
}
33263322

src/services/services.ts

Lines changed: 84 additions & 85 deletions
Large diffs are not rendered by default.

src/services/shims.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ namespace ts {
179179

180180
/**
181181
* Returns a JSON-encoded value of the type:
182-
* { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean, isDefinition?: boolean }[]
182+
* { fileName: string; textSpan: { start: number; length: number}; }[]
183183
*/
184184
getImplementationAtPosition(fileName: string, position: number): string;
185185

tests/cases/fourslash/fourslash.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ declare namespace FourSlashInterface {
110110
bof(): void;
111111
eof(): void;
112112
type(definitionIndex?: number): void;
113-
implementation(implementationIndex?: number): void;
113+
implementation(): void;
114114
position(position: number, fileIndex?: number): any;
115115
position(position: number, fileName?: string): any;
116116
file(index: number, content?: string, scriptKindName?: string): any;
@@ -134,7 +134,7 @@ declare namespace FourSlashInterface {
134134
quickInfoIs(expectedText?: string, expectedDocumentation?: string): void;
135135
quickInfoExists(): void;
136136
typeDefinitionCountIs(expectedCount: number): void;
137-
implementationCountIs(expectedCount: number): void;
137+
implementationListIsEmpty(): void;
138138
isValidBraceCompletionAtPosition(openingBrace?: string): void;
139139
}
140140
class verify extends verifyNegatable {
@@ -242,7 +242,7 @@ declare namespace FourSlashInterface {
242242
getSyntacticDiagnostics(expected: string): void;
243243
getSemanticDiagnostics(expected: string): void;
244244
ProjectInfo(expected: string[]): void;
245-
allRangesAppearInImplementationList(): void;
245+
allRangesAppearInImplementationList(markerName: string): void;
246246
}
247247
class edit {
248248
backspace(count?: number): void;

tests/cases/fourslash/goToImplementationClassMethod_00.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@
88
////
99
//// new Bar().hel/*reference*/lo;
1010

11-
goTo.marker("reference");
12-
verify.allRangesAppearInImplementationList();
11+
verify.allRangesAppearInImplementationList("reference");

tests/cases/fourslash/goToImplementationClassMethod_01.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,5 @@
1414
//// x.he/*reference*/llo();
1515
//// }
1616

17-
goTo.marker("reference");
18-
verify.allRangesAppearInImplementationList();
19-
20-
goTo.marker("declaration");
21-
verify.allRangesAppearInImplementationList();
17+
verify.allRangesAppearInImplementationList("reference");
18+
verify.allRangesAppearInImplementationList("declaration");

tests/cases/fourslash/goToImplementationEnum_00.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@
99
////
1010
//// Foo.Fo/*reference*/o1;
1111

12-
goTo.marker("reference");
13-
verify.allRangesAppearInImplementationList();
12+
verify.allRangesAppearInImplementationList("reference");

tests/cases/fourslash/goToImplementationEnum_01.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@
99
////
1010
//// Fo/*reference*/o;
1111

12-
goTo.marker("reference");
13-
verify.allRangesAppearInImplementationList();
12+
verify.allRangesAppearInImplementationList("reference");

tests/cases/fourslash/goToImplementationInterfaceMethod_00.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,5 @@
2121
//// constructor(public f: Foo = { [|hello() {/**3*/}|] } ) {}
2222
//// }
2323

24-
goTo.marker("function_call");
25-
verify.allRangesAppearInImplementationList();
26-
27-
goTo.marker("declaration");
28-
verify.allRangesAppearInImplementationList();
24+
verify.allRangesAppearInImplementationList("function_call");
25+
verify.allRangesAppearInImplementationList("declaration");

tests/cases/fourslash/goToImplementationInterfaceMethod_01.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,5 @@
1818
////
1919
//// whatever(new Bar());
2020

21-
goTo.marker("function_call");
22-
verify.allRangesAppearInImplementationList();
23-
24-
goTo.marker("declaration");
25-
verify.allRangesAppearInImplementationList();
21+
verify.allRangesAppearInImplementationList("function_call");
22+
verify.allRangesAppearInImplementationList("declaration");

0 commit comments

Comments
 (0)