feat(lsp): implement textDocument/prepareCallHierarchy (#10061)

This commit is contained in:
Jean Pierre 2021-04-19 00:11:26 -05:00 committed by GitHub
parent 0552eaf569
commit 65a2a04d3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 747 additions and 3 deletions

View file

@ -726,6 +726,33 @@ delete Object.prototype.__proto__;
ts.getSupportedCodeFixes(),
);
}
case "prepareCallHierarchy": {
return respond(
id,
languageService.prepareCallHierarchy(
request.specifier,
request.position,
),
);
}
case "provideCallHierarchyIncomingCalls": {
return respond(
id,
languageService.provideCallHierarchyIncomingCalls(
request.specifier,
request.position,
),
);
}
case "provideCallHierarchyOutgoingCalls": {
return respond(
id,
languageService.provideCallHierarchyOutgoingCalls(
request.specifier,
request.position,
),
);
}
default:
throw new TypeError(
// @ts-ignore exhausted case statement sets type to never

25
cli/tsc/compiler.d.ts vendored
View file

@ -63,7 +63,10 @@ declare global {
| GetReferencesRequest
| GetSignatureHelpItemsRequest
| GetSmartSelectionRange
| GetSupportedCodeFixes;
| GetSupportedCodeFixes
| PrepareCallHierarchy
| ProvideCallHierarchyIncomingCalls
| ProvideCallHierarchyOutgoingCalls;
interface BaseLanguageServerRequest {
id: number;
@ -185,4 +188,24 @@ declare global {
interface GetSupportedCodeFixes extends BaseLanguageServerRequest {
method: "getSupportedCodeFixes";
}
interface PrepareCallHierarchy extends BaseLanguageServerRequest {
method: "prepareCallHierarchy";
specifier: string;
position: number;
}
interface ProvideCallHierarchyIncomingCalls
extends BaseLanguageServerRequest {
method: "provideCallHierarchyIncomingCalls";
specifier: string;
position: number;
}
interface ProvideCallHierarchyOutgoingCalls
extends BaseLanguageServerRequest {
method: "provideCallHierarchyOutgoingCalls";
specifier: string;
position: number;
}
}