Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 10 additions & 19 deletions Extension/src/LanguageServer/Providers/callHierarchyProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ export interface CallHierarchyParams {

interface CallHierarchyItemResult {
item?: CallHierarchyItem;

/**
* If a request is cancelled, `succeeded` will be undefined to indicate no result was returned.
* Therefore, object is not defined as optional on the language server.
*/
succeeded: boolean;
}

interface CallHierarchyCallsItem {
Expand Down Expand Up @@ -137,25 +131,23 @@ export class CallHierarchyProvider implements vscode.CallHierarchyProvider {
}
throw e;
}
cancellationTokenListener.dispose();
requestCanceledListener.dispose();
finally {
cancellationTokenListener.dispose();
requestCanceledListener.dispose();
}

if (cancelSource.token.isCancellationRequested || response.succeeded === undefined) {
// Return undefined instead of vscode.CancellationError to avoid the following error message from VS Code:
// "MISSING provider."
// TODO: per issue https://github.com/microsoft/vscode/issues/169698 vscode.CancellationError is expected,
// so when VS Code fixes the error use vscode.CancellationError again.
return undefined;
} else if (response.item === undefined) {
if (cancelSource.token.isCancellationRequested) {
throw new vscode.CancellationError();
}
if (response.item === undefined) {
return undefined;
}

this.isEntryRootNodeTelemetry = true;
return this.makeVscodeCallHierarchyItem(response.item);
}

public async provideCallHierarchyIncomingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken):
Promise<vscode.CallHierarchyIncomingCall[] | undefined> {
public async provideCallHierarchyIncomingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyIncomingCall[] | undefined> {
await this.client.ready;
workspaceReferences.cancelCurrentReferenceRequest(CancellationSender.NewRequest);

Expand Down Expand Up @@ -215,8 +207,7 @@ export class CallHierarchyProvider implements vscode.CallHierarchyProvider {
return result;
}

public async provideCallHierarchyOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken):
Promise<vscode.CallHierarchyOutgoingCall[] | undefined> {
public async provideCallHierarchyOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Promise<vscode.CallHierarchyOutgoingCall[] | undefined> {
const CallHierarchyCallsFromEvent: string = "CallHierarchyCallsFrom";
if (item === undefined) {
this.logTelemetry(CallHierarchyCallsFromEvent, CallHierarchyRequestStatus.Failed);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ export class FindAllReferencesProvider implements vscode.ReferenceProvider {
throw e;
}
}

// Reset anything that can be cleared before processing the result.
workspaceReferences.resetProgressBar();
cancellationTokenListener.dispose();
requestCanceledListener.dispose();
finally {
// Reset anything that can be cleared before processing the result.
workspaceReferences.resetProgressBar();
cancellationTokenListener.dispose();
requestCanceledListener.dispose();
}

// Process the result.
if (cancelSource.token.isCancellationRequested || cancelled || (response && response.isCanceled)) {
Expand Down
11 changes: 6 additions & 5 deletions Extension/src/LanguageServer/Providers/renameProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@ export class RenameProvider implements vscode.RenameProvider {
}
throw e;
}

// Reset anything that can be cleared before processing the result.
workspaceReferences.resetProgressBar();
workspaceReferences.resetReferences();
requestCanceledListener.dispose();
finally {
// Reset anything that can be cleared before processing the result.
workspaceReferences.resetProgressBar();
workspaceReferences.resetReferences();
requestCanceledListener.dispose();
}

// Process the result.
if (cancelSource.token.isCancellationRequested || response.isCanceled) {
Expand Down
Loading