Skip to content

Commit 7e2e87a

Browse files
author
Jackson Kearl
committed
Use search.seedWithNearestWord setting instead of emptyness of search input to control nearest word seeding.
Ref microsoft#91901.
1 parent 23215fd commit 7e2e87a

3 files changed

Lines changed: 7 additions & 1 deletion

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.seedWithNearestWord': {
793+
type: 'boolean',
794+
default: false,
795+
description: nls.localize('search.seedWithNearestWord', "Enable seeding search from the word nearest the cursor when the active editor has no selection.")
796+
},
792797
'search.seedOnFocus': {
793798
type: 'boolean',
794799
default: false,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ export class SearchView extends ViewPane {
10701070
return null;
10711071
}
10721072

1073-
if (range.isEmpty() && !this.searchWidget.searchInput.getValue() && allowUnselectedWord) {
1073+
if (range.isEmpty() && this.searchConfig.seedWithNearestWord && allowUnselectedWord) {
10741074
const wordAtPosition = activeTextEditorControl.getModel().getWordAtPosition(range.getStartPosition());
10751075
if (wordAtPosition) {
10761076
return wordAtPosition.word;

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

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

0 commit comments

Comments
 (0)