Skip to content

Commit 97363a3

Browse files
Reset FAR UI if no results returned (#11359)
1 parent 28d5715 commit 97363a3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Extension/src/LanguageServer/Providers/findAllReferencesProvider.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import * as vscode from 'vscode';
66
import { Position, RequestType } from 'vscode-languageclient';
77
import { DefaultClient, workspaceReferences } from '../client';
8-
import { CancellationSender, ReferenceInfo, ReferencesParams, ReferencesResult, ReferenceType } from '../references';
8+
import { CancellationSender, ReferenceInfo, ReferenceType, ReferencesParams, ReferencesResult } from '../references';
99

1010
const FindAllReferencesRequest: RequestType<ReferencesParams, ReferencesResult, void> =
1111
new RequestType<ReferencesParams, ReferencesResult, void>('cpptools/findAllReferences');
@@ -37,7 +37,6 @@ export class FindAllReferencesProvider implements vscode.ReferenceProvider {
3737
const response: ReferencesResult = await this.client.languageClient.sendRequest(FindAllReferencesRequest, params, cancelSource.token);
3838

3939
// Reset anything that can be cleared before processing the result.
40-
// Note: ReferencesManager.resetReferences is called in ReferencesManager.showResultsInPanelView
4140
workspaceReferences.resetProgressBar();
4241
cancellationTokenListener.dispose();
4342
requestCanceledListener.dispose();
@@ -48,8 +47,9 @@ export class FindAllReferencesProvider implements vscode.ReferenceProvider {
4847
// "Cannot destructure property 'range' of 'e.location' as it is undefined."
4948
// TODO: per issue https://github.com/microsoft/vscode/issues/169698
5049
// vscode.CancellationError is expected, so when VS Code fixes the error use vscode.CancellationError again.
50+
workspaceReferences.resetReferences();
5151
return undefined;
52-
} else if (response.referenceInfos.length !== 0) {
52+
} else if (response.referenceInfos.length > 0) {
5353
response.referenceInfos.forEach((referenceInfo: ReferenceInfo) => {
5454
if (referenceInfo.type === ReferenceType.Confirmed) {
5555
const uri: vscode.Uri = vscode.Uri.file(referenceInfo.file);
@@ -60,7 +60,10 @@ export class FindAllReferencesProvider implements vscode.ReferenceProvider {
6060
});
6161

6262
// Display other reference types in panel or channel view.
63+
// Note: ReferencesManager.resetReferences is called in ReferencesManager.showResultsInPanelView
6364
workspaceReferences.showResultsInPanelView(response);
65+
} else {
66+
workspaceReferences.resetReferences();
6467
}
6568

6669
return locationsResult;

0 commit comments

Comments
 (0)