From ff6c225934a595ed1c0b0aadd998a2c2010063ea Mon Sep 17 00:00:00 2001 From: Rick Martin Date: Sat, 19 Jun 2021 16:35:37 -0700 Subject: [PATCH 1/2] Add search.maxResults setting --- .../workbench/contrib/search/browser/search.contribution.ts | 5 +++++ src/vs/workbench/contrib/search/browser/searchView.ts | 5 ++--- src/vs/workbench/services/search/common/search.ts | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/search/browser/search.contribution.ts b/src/vs/workbench/contrib/search/browser/search.contribution.ts index e54b8b2a8fb00..cb8a89f312efb 100644 --- a/src/vs/workbench/contrib/search/browser/search.contribution.ts +++ b/src/vs/workbench/contrib/search/browser/search.contribution.ts @@ -923,6 +923,11 @@ configurationRegistry.registerConfiguration({ description: nls.localize('search.location', "Controls whether the search will be shown as a view in the sidebar or as a panel in the panel area for more horizontal space."), deprecationMessage: nls.localize('search.location.deprecationMessage', "This setting is deprecated. You can drag the search icon to a new location instead.") }, + 'search.maxResults': { + type: ['number', 'null'], + default: 10000, + markdownDescription: nls.localize('search.maxResults', "Controls the maximum number of search results, this can be set to `null` (empty) to return unlimited results.") + }, 'search.collapseResults': { type: 'string', enum: ['auto', 'alwaysCollapse', 'alwaysExpand'], diff --git a/src/vs/workbench/contrib/search/browser/searchView.ts b/src/vs/workbench/contrib/search/browser/searchView.ts index d04d24e4104fa..90bb28ccaf017 100644 --- a/src/vs/workbench/contrib/search/browser/searchView.ts +++ b/src/vs/workbench/contrib/search/browser/searchView.ts @@ -20,6 +20,7 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { Disposable, DisposableStore, dispose } from 'vs/base/common/lifecycle'; import * as env from 'vs/base/common/platform'; import * as strings from 'vs/base/common/strings'; +import { withNullAsUndefined } from 'vs/base/common/types'; import { URI } from 'vs/base/common/uri'; import 'vs/css!./media/searchview'; import { getCodeEditor, ICodeEditor, isCodeEditor, isDiffEditor } from 'vs/editor/browser/editorBrowser'; @@ -87,8 +88,6 @@ export enum SearchViewPosition { const SEARCH_CANCELLED_MESSAGE = nls.localize('searchCanceled', "Search was canceled before any results could be found - "); export class SearchView extends ViewPane { - private static readonly MAX_TEXT_RESULTS = 10000; - private static readonly ACTIONS_RIGHT_CLASS_NAME = 'actions-right'; private isDisposed = false; @@ -1340,7 +1339,7 @@ export class SearchView extends ViewPane { const options: ITextQueryBuilderOptions = { _reason: 'searchView', extraFileResources: this.instantiationService.invokeFunction(getOutOfWorkspaceEditorResources), - maxResults: SearchView.MAX_TEXT_RESULTS, + maxResults: withNullAsUndefined(this.searchConfig.maxResults), disregardIgnoreFiles: !useExcludesAndIgnoreFiles || undefined, disregardExcludeSettings: !useExcludesAndIgnoreFiles || undefined, onlyOpenEditors: onlySearchInOpenEditors, diff --git a/src/vs/workbench/services/search/common/search.ts b/src/vs/workbench/services/search/common/search.ts index aa77766048dfd..f5f670c7956a5 100644 --- a/src/vs/workbench/services/search/common/search.ts +++ b/src/vs/workbench/services/search/common/search.ts @@ -372,6 +372,7 @@ export interface ISearchConfigurationProperties { usePCRE2: boolean; actionsPosition: 'auto' | 'right'; maintainFileSearchCache: boolean; + maxResults: number | null; collapseResults: 'auto' | 'alwaysCollapse' | 'alwaysExpand'; searchOnType: boolean; seedOnFocus: boolean; From c9efca67b6597b755afaa694b0c85b0b50f5d475 Mon Sep 17 00:00:00 2001 From: Rick Martin Date: Tue, 22 Jun 2021 17:59:02 -0700 Subject: [PATCH 2/2] Update search.maxResults setting default to 20000 --- src/vs/workbench/contrib/search/browser/search.contribution.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/search/browser/search.contribution.ts b/src/vs/workbench/contrib/search/browser/search.contribution.ts index cb8a89f312efb..85f20517a215e 100644 --- a/src/vs/workbench/contrib/search/browser/search.contribution.ts +++ b/src/vs/workbench/contrib/search/browser/search.contribution.ts @@ -925,7 +925,7 @@ configurationRegistry.registerConfiguration({ }, 'search.maxResults': { type: ['number', 'null'], - default: 10000, + default: 20000, markdownDescription: nls.localize('search.maxResults', "Controls the maximum number of search results, this can be set to `null` (empty) to return unlimited results.") }, 'search.collapseResults': {