-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improves the commit search experience
Remembers and restores the last commit search string Adds search command to the results inline toolbar Reopens search when clicking on a result node with no results Fixes encoded html in empty state
- Loading branch information
Showing
9 changed files
with
126 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
'use strict'; | ||
import { TreeItem } from 'vscode'; | ||
import { SearchCommitsCommandArgs } from '../../commands'; | ||
import { Commands } from '../../commands/common'; | ||
import { GitRepoSearchBy } from '../../git/gitService'; | ||
import { View } from '../viewBase'; | ||
import { CommitsQueryResults, ResultsCommitsNode } from './resultsCommitsNode'; | ||
import { ResourceType, ViewNode } from './viewNode'; | ||
|
||
export class SearchResultsCommitsNode extends ResultsCommitsNode { | ||
constructor( | ||
view: View, | ||
parent: ViewNode, | ||
repoPath: string, | ||
public readonly search: string, | ||
public readonly searchBy: GitRepoSearchBy, | ||
commitsQuery: (maxCount: number | undefined) => Promise<CommitsQueryResults> | ||
) { | ||
super(view, parent, repoPath, commitsQuery); | ||
} | ||
|
||
get type(): ResourceType { | ||
return ResourceType.SearchResults; | ||
} | ||
|
||
async getTreeItem(): Promise<TreeItem> { | ||
const { log } = await super.getCommitsQueryResults(); | ||
|
||
const item = await super.getTreeItem(); | ||
|
||
if (log == null || log.count === 0) { | ||
const args: SearchCommitsCommandArgs = { | ||
search: this.search, | ||
searchBy: this.searchBy, | ||
prefillOnly: true | ||
}; | ||
item.command = { | ||
title: 'Search Commits', | ||
command: Commands.SearchCommitsInView, | ||
arguments: [args] | ||
}; | ||
} | ||
|
||
return item; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters