Skip to content

Commit 7dca4f1

Browse files
author
Jackson Kearl
committed
Add command to disable seeding workspace search text on focus. Ref microsoft#91901.
1 parent bdeed50 commit 7dca4f1

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/vs/workbench/contrib/search/browser/search.contribution.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,11 @@ configurationRegistry.registerConfiguration({
789789
default: true,
790790
description: nls.localize('search.searchOnType', "Search all files as you type.")
791791
},
792+
'search.seedOnFocus': {
793+
type: 'boolean',
794+
default: true,
795+
description: nls.localize('search.seedOnFocus', "Update workspace seach query to the editor's selected text when focusing the search view. This happens either on click or when triggering the `workbench.views.search.focus` command.")
796+
},
792797
'search.searchOnTypeDebouncePeriod': {
793798
type: 'number',
794799
default: 300,

src/vs/workbench/contrib/search/browser/searchView.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -859,8 +859,7 @@ export class SearchView extends ViewPane {
859859

860860
focus(): void {
861861
super.focus();
862-
863-
const updatedText = this.updateTextFromSelection({ allowSearchOnType: false });
862+
const updatedText = this.searchConfig.seedOnFocus ? this.updateTextFromSelection({ allowSearchOnType: false }) : false;
864863
this.searchWidget.focus(undefined, undefined, updatedText);
865864
}
866865

src/vs/workbench/services/search/common/search.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ export interface ISearchConfigurationProperties {
344344
maintainFileSearchCache: boolean;
345345
collapseResults: 'auto' | 'alwaysCollapse' | 'alwaysExpand';
346346
searchOnType: boolean;
347+
seedOnFocus: boolean;
347348
searchOnTypeDebouncePeriod: number;
348349
searchEditor: {
349350
doubleClickBehaviour: 'selectWord' | 'goToLocation' | 'openLocationToSide',

0 commit comments

Comments
 (0)