Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add search.maxResults setting #126762

Merged
merged 2 commits into from
Jun 23, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
5 changes: 2 additions & 3 deletions src/vs/workbench/contrib/search/browser/searchView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/services/search/common/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down