Skip to content

Commit 381799d

Browse files
committed
Build new functionality into go-to-implementation
1 parent 309c4bb commit 381799d

18 files changed

+177
-237
lines changed

src/harness/client.ts

-20
Original file line numberDiff line numberDiff line change
@@ -334,26 +334,6 @@ namespace ts.server {
334334
}));
335335
}
336336

337-
getSourceDefinitionAndBoundSpan(fileName: string, position: number): DefinitionInfoAndBoundSpan {
338-
const args: protocol.FileLocationRequestArgs = this.createFileLocationRequestArgs(fileName, position);
339-
const request = this.processRequest<protocol.SourceDefinitionAndBoundSpanRequest>(CommandNames.SourceDefinitionAndBoundSpan, args);
340-
const response = this.processResponse<protocol.DefinitionInfoAndBoundSpanResponse>(request);
341-
const body = Debug.checkDefined(response.body); // TODO: GH#18217
342-
343-
return {
344-
definitions: body.definitions.map(entry => ({
345-
containerKind: ScriptElementKind.unknown,
346-
containerName: "",
347-
fileName: entry.file,
348-
textSpan: this.decodeSpan(entry),
349-
kind: ScriptElementKind.unknown,
350-
name: "",
351-
unverified: entry.unverified,
352-
})),
353-
textSpan: this.decodeSpan(body.textSpan, request.arguments.file)
354-
};
355-
}
356-
357337
getImplementationAtPosition(fileName: string, position: number): ImplementationLocation[] {
358338
const args = this.createFileLocationRequestArgs(fileName, position);
359339

src/harness/fourslashImpl.ts

+6-8
Original file line numberDiff line numberDiff line change
@@ -697,13 +697,6 @@ namespace FourSlash {
697697
this.verifyGoToX(arg0, endMarkerNames, () => this.getGoToDefinitionAndBoundSpan());
698698
}
699699

700-
public verifyGoToSourceDefinition(startMarkerNames: ArrayOrSingle<string>, end?: ArrayOrSingle<string | { marker: string, unverified?: boolean }> | { file: string, unverified?: boolean }) {
701-
if (this.testType !== FourSlashTestType.Server) {
702-
this.raiseError("goToSourceDefinition may only be used in fourslash/server tests.");
703-
}
704-
this.verifyGoToX(startMarkerNames, end, () => (this.languageService as ts.server.SessionClient).getSourceDefinitionAndBoundSpan(this.activeFile.fileName, this.currentCaretPosition)!);
705-
}
706-
707700
private getGoToDefinition(): readonly ts.DefinitionInfo[] {
708701
return this.languageService.getDefinitionAtPosition(this.activeFile.fileName, this.currentCaretPosition)!;
709702
}
@@ -2447,7 +2440,12 @@ namespace FourSlash {
24472440
assert.isTrue(implementations && implementations.length > 0, "Expected at least one implementation but got 0");
24482441
}
24492442
else {
2450-
assert.isUndefined(implementations, "Expected implementation list to be empty but implementations returned");
2443+
if (this.testType === FourSlashTestType.Server) {
2444+
assert.deepEqual(implementations, [], "Expected implementation list to be empty but implementations returned");
2445+
}
2446+
else {
2447+
assert.isUndefined(implementations, "Expected implementation list to be empty but implementations returned");
2448+
}
24512449
}
24522450
}
24532451

src/harness/fourslashInterfaceImpl.ts

-4
Original file line numberDiff line numberDiff line change
@@ -324,10 +324,6 @@ namespace FourSlashInterface {
324324
this.state.verifyGoToType(arg0, endMarkerName);
325325
}
326326

327-
public goToSourceDefinition(startMarkerNames: ArrayOrSingle<string>, end: { file: string } | ArrayOrSingle<string>) {
328-
this.state.verifyGoToSourceDefinition(startMarkerNames, end);
329-
}
330-
331327
public goToDefinitionForMarkers(...markerNames: string[]) {
332328
this.state.verifyGoToDefinitionForMarkers(markerNames);
333329
}

src/server/protocol.ts

-7
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ namespace ts.server.protocol {
8383
SignatureHelp = "signatureHelp",
8484
/* @internal */
8585
SignatureHelpFull = "signatureHelp-full",
86-
SourceDefinitionAndBoundSpan = "sourceDefinitionAndBoundSpan",
87-
/* @internal */
88-
SourceDefinitionAndBoundSpanFull = "sourceDefinitionAndBoundSpan-full",
8986
Status = "status",
9087
TypeDefinition = "typeDefinition",
9188
ProjectInfo = "projectInfo",
@@ -907,10 +904,6 @@ namespace ts.server.protocol {
907904
readonly command: CommandTypes.DefinitionAndBoundSpan;
908905
}
909906

910-
export interface SourceDefinitionAndBoundSpanRequest extends FileLocationRequest {
911-
readonly command: CommandTypes.SourceDefinitionAndBoundSpan;
912-
}
913-
914907
export interface DefinitionAndBoundSpanResponse extends Response {
915908
readonly body: DefinitionInfoAndBoundSpan;
916909
}

0 commit comments

Comments
 (0)