Skip to content

Commit

Permalink
Closes #728 - Adds advanced.maxSearchItems
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed May 1, 2019
1 parent 3780b39 commit 7bd9290
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,7 @@ See also [View Settings](#view-settings- 'Jump to the View settings')
| `gitlens.advanced.caching.enabled` | Specifies whether git output will be cached — changing the default is not recommended |
| `gitlens.advanced.fileHistoryFollowsRenames` | Specifies whether file histories will follow renames -- will affect how merge commits are shown in histories |
| `gitlens.advanced.maxListItems` | Specifies the maximum number of items to show in a list. Use 0 to specify no maximum |
| `gitlens.advanced.maxSearchItems` | Specifies the maximum number of items to show in a search. Use 0 to specify no maximum |
| `gitlens.advanced.messages` | Specifies which messages should be suppressed |
| `gitlens.advanced.quickPick.closeOnFocusOut` | Specifies whether to close QuickPick menus when focus is lost |
| `gitlens.advanced.repositorySearchDepth` | Specifies how many folders deep to search for repositories |
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1668,6 +1668,12 @@
"markdownDescription": "Specifies the maximum number of items to show in a list. Use 0 to specify no maximum",
"scope": "window"
},
"gitlens.advanced.maxSearchItems": {
"type": "number",
"default": 200,
"markdownDescription": "Specifies the maximum number of items to show in a search. Use 0 to specify no maximum",
"scope": "window"
},
"gitlens.advanced.messages": {
"type": "object",
"default": {
Expand Down
6 changes: 1 addition & 5 deletions src/commands/searchCommits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const searchByToSymbolMap = new Map<GitRepoSearchBy, string>([
export interface SearchCommitsCommandArgs {
search?: string;
searchBy?: GitRepoSearchBy;
maxCount?: number;
prefillOnly?: boolean;
showInView?: boolean;

Expand Down Expand Up @@ -177,7 +176,6 @@ export class SearchCommitsCommand extends ActiveEditorCachedCommand {

if (args.showInView) {
void Container.searchView.search(repoPath, args.search, args.searchBy, {
maxCount: args.maxCount,
label: { label: searchLabel! }
});

Expand All @@ -186,9 +184,7 @@ export class SearchCommitsCommand extends ActiveEditorCachedCommand {

const progressCancellation = CommitsQuickPick.showProgress(searchLabel!);
try {
const log = await Container.git.getLogForSearch(repoPath, args.search, args.searchBy, {
maxCount: args.maxCount
});
const log = await Container.git.getLogForSearch(repoPath, args.search, args.searchBy);

if (progressCancellation.token.isCancellationRequested) return undefined;

Expand Down
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ export interface AdvancedConfig {
};
fileHistoryFollowsRenames: boolean;
maxListItems: number;
maxSearchItems: number;
messages: {
suppressCommitHasNoPreviousCommitWarning: boolean;
suppressCommitNotFoundWarning: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/git/gitService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1441,7 +1441,7 @@ export class GitService implements Disposable {
searchBy: GitRepoSearchBy,
options: { maxCount?: number } = {}
): Promise<GitLog | undefined> {
let maxCount = options.maxCount == null ? Container.config.advanced.maxListItems || 0 : options.maxCount;
let maxCount = options.maxCount == null ? Container.config.advanced.maxSearchItems || 0 : options.maxCount;
const similarityThreshold = Container.config.advanced.similarityThreshold;

let searchArgs: string[] | undefined = undefined;
Expand Down

0 comments on commit 7bd9290

Please sign in to comment.