Skip to content

Commit f00ee84

Browse files
authored
add message for blank picker in quick search (microsoft#202625)
add message for blank picker
1 parent 6d6bb58 commit f00ee84

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ export class TextSearchQuickAccess extends PickerQuickAccessProvider<IPickerQuic
9494
picker.customButton = true;
9595
picker.customLabel = '$(link-external)';
9696
picker.onDidCustom(() => {
97-
this.moveToSearchViewlet(undefined);
97+
if (this.searchModel.searchResult.count() > 0) {
98+
this.moveToSearchViewlet(undefined);
99+
} else {
100+
this._viewsService.openView(VIEW_ID, true);
101+
}
98102
picker.hide();
99103
});
100104
disposables.add(super.provide(picker, token, runOptions));
@@ -279,21 +283,23 @@ export class TextSearchQuickAccess extends PickerQuickAccessProvider<IPickerQuic
279283

280284
protected _getPicks(contentPattern: string, disposables: DisposableStore, token: CancellationToken): Picks<IQuickPickItem> | Promise<Picks<IQuickPickItem> | FastAndSlowPicks<IQuickPickItem>> | FastAndSlowPicks<IQuickPickItem> | null {
281285

282-
const conditionalTokenCts = disposables.add(new CancellationTokenSource());
283-
284286
const searchModelAtTimeOfSearch = this.searchModel;
287+
if (contentPattern === '') {
288+
289+
this.searchModel.searchResult.clear();
290+
return [{
291+
label: localize('enterSearchTerm', "Enter a term to search for across your files.")
292+
}];
293+
}
294+
295+
const conditionalTokenCts = disposables.add(new CancellationTokenSource());
285296

286297
disposables.add(token.onCancellationRequested(() => {
287298
if (searchModelAtTimeOfSearch.location === SearchModelLocation.QUICK_ACCESS) {
288299
// if the search model has not been imported to the panel, you can cancel
289300
conditionalTokenCts.cancel();
290301
}
291302
}));
292-
293-
if (contentPattern === '') {
294-
this.searchModel.searchResult.clear();
295-
return [];
296-
}
297303
const allMatches = this.doSearch(contentPattern, conditionalTokenCts.token);
298304

299305
if (!allMatches) {

0 commit comments

Comments
 (0)