Browse Source

Aligns commit quick pick and context menu commands

Renames show commit in view to search for commit in side bar
main
Eric Amodio 4 years ago
parent
commit
66bacbb74e
18 changed files with 307 additions and 251 deletions
  1. +27
    -27
      README.md
  2. +10
    -10
      package.json
  3. +10
    -10
      src/commands/git/search.ts
  4. +4
    -4
      src/commands/git/stash.ts
  5. +7
    -7
      src/commands/quickCommand.buttons.ts
  6. +147
    -137
      src/commands/quickCommand.steps.ts
  7. +4
    -4
      src/commands/searchCommits.ts
  8. +3
    -5
      src/commands/showCommitsInView.ts
  9. +3
    -3
      src/commands/showQuickFileHistory.ts
  10. +1
    -1
      src/config.ts
  11. +10
    -3
      src/git/git.ts
  12. +7
    -0
      src/git/gitService.ts
  13. +35
    -0
      src/quickpicks/commitQuickPickItems.ts
  14. +30
    -31
      src/quickpicks/quickPicksItems.ts
  15. +2
    -2
      src/statusbar/statusBarController.ts
  16. +1
    -1
      src/views/nodes/searchResultsCommitsNode.ts
  17. +4
    -4
      src/webviews/apps/settings/partials/code-lens.html
  18. +2
    -2
      src/webviews/apps/settings/partials/status-bar.html

+ 27
- 27
README.md View File

@ -678,28 +678,28 @@ GitLens is highly customizable and provides many configuration settings to allow
### Git Code Lens Settings [#](#git-code-lens-settings- 'Git Code Lens Settings')
| Name | Description |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.codeLens.authors.command` | Specifies the command to be executed when an _authors_ code lens is clicked, set to (`gitlens.toggleFileBlame`) by default. Can be set to `false` to disable click actions on the code lens.<br /><br />`gitlens.toggleFileBlame` - toggles file blame annotations<br />`gitlens.diffWithPrevious` - compares the current committed file with the previous commit<br />`gitlens.revealCommitInView` - reveals the commit in the Repositories view<br />`gitlens.showCommitsInView` - shows the commits within the range in the Search Commits view<br />`gitlens.showQuickCommitDetails` - shows a commit details quick pick<br />`gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick<br />`gitlens.showQuickFileHistory` - shows a file history quick pick<br />`gitlens.showQuickRepoHistory` - shows a branch history quick pick |
| `gitlens.codeLens.authors.enabled` | Specifies whether to provide an _authors_ code lens, showing number of authors of the file or code block and the most prominent author (if there is more than one) |
| `gitlens.codeLens.enabled` | Specifies whether to provide any Git code lens, by default. Use the _Toggle Git Code Lens_ command (`gitlens.toggleCodeLens`) to toggle the Git code lens on and off for the current window |
| `gitlens.codeLens.includeSingleLineSymbols` | Specifies whether to provide any Git code lens on symbols that span only a single line |
| `gitlens.codeLens.recentChange.command` | Specifies the command to be executed when a _recent change_ code lens is clicked, set to (`gitlens.showQuickCommitFileDetails`) by default. Can be set to `false` to disable click actions on the code lens.<br /><br />`gitlens.toggleFileBlame` - toggles file blame annotations<br />`gitlens.diffWithPrevious` - compares the current committed file with the previous commit<br />`gitlens.revealCommitInView` - reveals the commit in the Repositories view<br />`gitlens.showCommitsInView` - shows the commit in the Search Commits view<br />`gitlens.showQuickCommitDetails` - shows a commit details quick pick<br />`gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick<br />`gitlens.showQuickFileHistory` - shows a file history quick pick<br />`gitlens.showQuickRepoHistory` - shows a branch history quick pick |
| `gitlens.codeLens.recentChange.enabled` | Specifies whether to provide a _recent change_ code lens, showing the author and date of the most recent commit for the file or code block |
| `gitlens.codeLens.scopes` | Specifies where Git code lens will be shown in the document<br /><br />`document` - adds code lens at the top of the document<br />`containers` - adds code lens at the start of container-like symbols (modules, classes, interfaces, etc)<br />`blocks` - adds code lens at the start of block-like symbols (functions, methods, etc) lines |
| `gitlens.codeLens.scopesByLanguage` | Deprecated. Use per-language `gitlens.codeLens.scopes` and `gitlens.codeLens.symbolScopes` settings instead |
| `gitlens.codeLens.symbolScopes` | Specifies a set of document symbols where Git code lens will or will not be shown in the document. Prefix with `!` to avoid providing a Git code lens for the symbol. Must be a member of [`SymbolKind`](https://code.visualstudio.com/docs/extensionAPI/vscode-api#_a-namesymbolkindaspan-classcodeitem-id660symbolkindspan) |
| Name | Description |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.codeLens.authors.command` | Specifies the command to be executed when an _authors_ code lens is clicked, set to (`gitlens.toggleFileBlame`) by default. Can be set to `false` to disable click actions on the code lens.<br /><br />`gitlens.toggleFileBlame` - toggles file blame annotations<br />`gitlens.diffWithPrevious` - opens changes with the previous revision<br />`gitlens.revealCommitInView` - reveals the commit in the Side Bar<br />`gitlens.showCommitsInView` - searches for the commits within the range in the Side Bar<br />`gitlens.showQuickCommitDetails` - shows details of the commit<br />`gitlens.showQuickCommitFileDetails` - show file details of the commit<br />`gitlens.showQuickFileHistory` - shows the current file history<br />`gitlens.showQuickRepoHistory` - shows the current branch history |
| `gitlens.codeLens.authors.enabled` | Specifies whether to provide an _authors_ code lens, showing number of authors of the file or code block and the most prominent author (if there is more than one) |
| `gitlens.codeLens.enabled` | Specifies whether to provide any Git code lens, by default. Use the _Toggle Git Code Lens_ command (`gitlens.toggleCodeLens`) to toggle the Git code lens on and off for the current window |
| `gitlens.codeLens.includeSingleLineSymbols` | Specifies whether to provide any Git code lens on symbols that span only a single line |
| `gitlens.codeLens.recentChange.command` | Specifies the command to be executed when a _recent change_ code lens is clicked, set to (`gitlens.showQuickCommitFileDetails`) by default. Can be set to `false` to disable click actions on the code lens.<br /><br />`gitlens.toggleFileBlame` - toggles file blame annotations<br />`gitlens.diffWithPrevious` - opens changes with the previous revision<br />`gitlens.revealCommitInView` - reveals the commit in the Side Bar<br />`gitlens.showCommitsInView` - searches for the commit in the Side Bar<br />`gitlens.showQuickCommitDetails` - shows details of the commit<br />`gitlens.showQuickCommitFileDetails` - show file details of the commit<br />`gitlens.showQuickFileHistory` - shows the current file history<br />`gitlens.showQuickRepoHistory` - shows the current branch history |
| `gitlens.codeLens.recentChange.enabled` | Specifies whether to provide a _recent change_ code lens, showing the author and date of the most recent commit for the file or code block |
| `gitlens.codeLens.scopes` | Specifies where Git code lens will be shown in the document<br /><br />`document` - adds code lens at the top of the document<br />`containers` - adds code lens at the start of container-like symbols (modules, classes, interfaces, etc)<br />`blocks` - adds code lens at the start of block-like symbols (functions, methods, etc) lines |
| `gitlens.codeLens.scopesByLanguage` | Deprecated. Use per-language `gitlens.codeLens.scopes` and `gitlens.codeLens.symbolScopes` settings instead |
| `gitlens.codeLens.symbolScopes` | Specifies a set of document symbols where Git code lens will or will not be shown in the document. Prefix with `!` to avoid providing a Git code lens for the symbol. Must be a member of [`SymbolKind`](https://code.visualstudio.com/docs/extensionAPI/vscode-api#_a-namesymbolkindaspan-classcodeitem-id660symbolkindspan) |
### Status Bar Settings [#](#status-bar-settings- 'Status Bar Settings')
| Name | Description |
| --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.statusBar.alignment` | Specifies the blame alignment in the status bar<br /><br />`left` - aligns to the left<br />`right` - aligns to the right |
| `gitlens.statusBar.command` | Specifies the command to be executed when the blame status bar item is clicked<br /><br />`gitlens.toggleFileBlame` - toggles file blame annotations<br />`gitlens.diffWithPrevious` - compares the current line commit with the previous<br />`gitlens.diffWithWorking` - compares the current line commit with the working tree<br />`gitlens.toggleCodeLens` - toggles Git code lens<br />`gitlens.showQuickCommitDetails` - shows a commit details quick pick<br />`gitlens.showQuickCommitFileDetails` - shows a commit file details quick pick<br />`gitlens.showQuickFileHistory` - shows a file history quick pick<br />`gitlens.showQuickRepoHistory` - shows a branch history quick pick |
| `gitlens.statusBar.dateFormat` | Specifies how to format absolute dates (e.g. using the `${date}` token) in the blame information in the status bar. See the [Moment.js docs](https://momentjs.com/docs/#/displaying/format/) for valid formats |
| `gitlens.statusBar.enabled` | Specifies whether to provide blame information in the status bar |
| `gitlens.statusBar.format` | Specifies the format of the blame information in the status bar. See [_Commit Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs. Date formatting is controlled by the `gitlens.statusBar.dateFormat` setting |
| `gitlens.statusBar.reduceFlicker` | Specifies whether to avoid clearing the previous blame information when changing lines to reduce status bar "flashing" |
| Name | Description |
| --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitlens.statusBar.alignment` | Specifies the blame alignment in the status bar<br /><br />`left` - aligns to the left<br />`right` - aligns to the right |
| `gitlens.statusBar.command` | Specifies the command to be executed when the blame status bar item is clicked<br /><br />`gitlens.toggleFileBlame` - toggles file blame annotations<br />`gitlens.diffWithPrevious` - opens line changes with the previous revision<br />`gitlens.diffWithWorking` - opens line changes with the working file<br />`gitlens.revealCommitInView` - reveals the commit in the Side Bar<br />`gitlens.showCommitsInView` - searches for the commit in the Side Bar<br />`gitlens.toggleCodeLens` - toggles the Git code lens<br />`gitlens.showQuickCommitDetails` - shows details of the commit<br />`gitlens.showQuickCommitFileDetails` - show file details of the commit<br />`gitlens.showQuickFileHistory` - shows the current file history<br />`gitlens.showQuickRepoHistory` - shows the current branch history |
| `gitlens.statusBar.dateFormat` | Specifies how to format absolute dates (e.g. using the `${date}` token) in the blame information in the status bar. See the [Moment.js docs](https://momentjs.com/docs/#/displaying/format/) for valid formats |
| `gitlens.statusBar.enabled` | Specifies whether to provide blame information in the status bar |
| `gitlens.statusBar.format` | Specifies the format of the blame information in the status bar. See [_Commit Tokens_](https://github.com/eamodio/vscode-gitlens/wiki/Custom-Formatting#commit-tokens) in the GitLens docs. Date formatting is controlled by the `gitlens.statusBar.dateFormat` setting |
| `gitlens.statusBar.reduceFlicker` | Specifies whether to avoid clearing the previous blame information when changing lines to reduce status bar "flashing" |
### Hover Settings [#](#hover-settings- 'Hover Settings')
@ -831,14 +831,14 @@ See also [View Settings](#view-settings- 'Jump to the View settings')
### Git Commands Menu Settings [#](#git-commands-menu-settings- 'Git Commands Menu Settings')
| Name | Description |
| ---------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `gitlens.gitCommands.closeOnFocusOut` | Specifies whether to dismiss the Git Commands menu when focus is lost (if not, press `ESC` to dismiss) |
| `gitlens.gitCommands.search.matchAll` | Specifies whether to match all or any commit message search patterns |
| `gitlens.gitCommands.search.matchCase` | Specifies whether to match commit search patterns with or without regard to casing |
| `gitlens.gitCommands.search.matchRegex` | Specifies whether to match commit search patterns using regular expressions |
| `gitlens.gitCommands.search.showResultsInView` | Specifies whether to show the commit search results in the _Search Commits_ view or directly within the quick pick menu |
| `gitlens.gitCommands.skipConfirmations` | Specifies which (and when) Git commands will skip the confirmation step, using the format: `git-command-name:(menu | command)` |
| Name | Description |
| ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| `gitlens.gitCommands.closeOnFocusOut` | Specifies whether to dismiss the Git Commands menu when focus is lost (if not, press `ESC` to dismiss) |
| `gitlens.gitCommands.search.matchAll` | Specifies whether to match all or any commit message search patterns |
| `gitlens.gitCommands.search.matchCase` | Specifies whether to match commit search patterns with or without regard to casing |
| `gitlens.gitCommands.search.matchRegex` | Specifies whether to match commit search patterns using regular expressions |
| `gitlens.gitCommands.search.showResultsInSideBar` | Specifies whether to show the commit search results in the Side Bar or within the quick pick menu |
| `gitlens.gitCommands.skipConfirmations` | Specifies which (and when) Git commands will skip the confirmation step, using the format: `git-command-name:(menu | command)` |
### Date & Time Settings [#](#date--time-settings- 'Date & Time Settings')

+ 10
- 10
package.json View File

@ -264,8 +264,8 @@
"enumDescriptions": [
"Toggles file blame annotations",
"Compares the current committed file with the previous commit",
"Reveals the commit in the side bar",
"Shows the commits within the range in the Search Commits view",
"Reveals the commit in the Side Bar",
"Searches for commits within the range in the Side Bar",
"Shows a commit details quick pick",
"Shows a commit file details quick pick",
"Shows a file history quick pick",
@ -317,8 +317,8 @@
"enumDescriptions": [
"Toggles file blame annotations",
"Compares the current committed file with the previous commit",
"Reveals the commit in the side bar",
"Shows the commit in the Search Commits view",
"Reveals the commit in the Side Bar",
"Searches for the commit in the Side Bar",
"Shows a commit details quick pick",
"Shows a commit file details quick pick",
"Shows a file history quick pick",
@ -558,10 +558,10 @@
"markdownDescription": "Specifies whether to match commit search patterns using regular expressions",
"scope": "window"
},
"gitlens.gitCommands.search.showResultsInView": {
"gitlens.gitCommands.search.showResultsInSideBar": {
"type": "boolean",
"default": false,
"markdownDescription": "Specifies whether to show the commit search results in the _Search Commits_ view or directly within the quick pick menu",
"markdownDescription": "Specifies whether to show the commit search results in the Side Bar or within the quick pick menu",
"scope": "window"
},
"gitlens.gitCommands.skipConfirmations": {
@ -1423,8 +1423,8 @@
"Compares the current line commit with the previous",
"Compares the current line commit with the working tree",
"Toggles Git code lens",
"Reveals the commit in the side bar",
"Shows the commit in the Search Commits view",
"Reveals the commit in the Side Bar",
"Searches for the commit in the Side Bar",
"Shows a commit details quick pick",
"Shows a commit file details quick pick",
"Shows a file history quick pick",
@ -2566,12 +2566,12 @@
},
{
"command": "gitlens.showCommitInView",
"title": "Show Commit in Search Commits View",
"title": "Search for Commit in Side Bar",
"category": "GitLens"
},
{
"command": "gitlens.showCommitsInView",
"title": "Show Commits within Selection in Search Commits View",
"title": "Search for Commits within Selection",
"category": "GitLens"
},
{

+ 10
- 10
src/commands/git/search.ts View File

@ -29,7 +29,7 @@ interface Context {
interface State extends Required<SearchPattern> {
repo: string | Repository;
showResultsInView: boolean;
showResultsInSideBar: boolean;
}
export interface SearchGitCommandArgs {
@ -103,8 +103,8 @@ export class SearchGitCommand extends QuickCommand {
if (state.matchRegex == null) {
state.matchRegex = cfg.matchRegex;
}
if (state.showResultsInView == null) {
state.showResultsInView = cfg.showResultsInView;
if (state.showResultsInSideBar == null) {
state.showResultsInSideBar = cfg.showResultsInSideBar;
}
let skippedStepOne = false;
@ -163,7 +163,7 @@ export class SearchGitCommand extends QuickCommand {
context.resultsKey = searchKey;
}
if (state.showResultsInView) {
if (state.showResultsInSideBar) {
void Container.searchView.search(
state.repo.path,
search,
@ -189,8 +189,8 @@ export class SearchGitCommand extends QuickCommand {
number: log.hasMore ? `${log.count}+` : undefined,
})} for ${state.pattern}`,
picked: context.commit?.ref,
showInViewButton: {
button: QuickCommandButtons.ShowResultsInView,
showInSideBarButton: {
button: QuickCommandButtons.ShowResultsInSideBar,
onDidClick: () =>
void Container.searchView.search(
repoPath,
@ -266,9 +266,9 @@ export class SearchGitCommand extends QuickCommand {
const matchCaseButton = new QuickCommandButtons.MatchCaseToggle(state.matchCase);
const matchAllButton = new QuickCommandButtons.MatchAllToggle(state.matchAll);
const matchRegexButton = new QuickCommandButtons.MatchRegexToggle(state.matchRegex);
const showResultsInViewButton = new QuickCommandButtons.ShowResultsInViewToggle(state.showResultsInView, () => {
state.showResultsInView = !state.showResultsInView;
showResultsInViewButton.on = state.showResultsInView;
const showResultsToggleButton = new QuickCommandButtons.ShowResultsToggle(state.showResultsInSideBar, () => {
state.showResultsInSideBar = !state.showResultsInSideBar;
showResultsToggleButton.on = state.showResultsInSideBar;
});
const step = QuickCommand.createPickStep<QuickPickItemOfT<SearchOperators>>({
@ -276,7 +276,7 @@ export class SearchGitCommand extends QuickCommand {
placeholder: 'e.g. "Updates dependencies" author:eamodio',
matchOnDescription: true,
matchOnDetail: true,
additionalButtons: [matchCaseButton, matchAllButton, matchRegexButton, showResultsInViewButton],
additionalButtons: [matchCaseButton, matchAllButton, matchRegexButton, showResultsToggleButton],
items: items,
value: state.pattern,
onDidAccept: (quickpick): boolean => {

+ 4
- 4
src/commands/git/stash.ts View File

@ -355,9 +355,9 @@ export class StashGitCommand extends QuickCommand {
undefined,
{
placeholder: `Confirm ${context.title}`,
additionalButtons: [QuickCommandButtons.RevealInView],
additionalButtons: [QuickCommandButtons.RevealInSideBar],
onDidClickButton: (quickpick, button) => {
if (button === QuickCommandButtons.RevealInView) {
if (button === QuickCommandButtons.RevealInSideBar) {
void GitActions.Stash.reveal(state.reference, {
select: true,
expand: true,
@ -414,9 +414,9 @@ export class StashGitCommand extends QuickCommand {
undefined,
{
placeholder: `Confirm ${context.title}`,
additionalButtons: [QuickCommandButtons.RevealInView],
additionalButtons: [QuickCommandButtons.RevealInSideBar],
onDidClickButton: (quickpick, button) => {
if (button === QuickCommandButtons.RevealInView) {
if (button === QuickCommandButtons.RevealInSideBar) {
void GitActions.Stash.reveal(state.reference, {
select: true,
expand: true,

+ 7
- 7
src/commands/quickCommand.buttons.ts View File

@ -97,27 +97,27 @@ export namespace QuickCommandButtons {
}
};
export const RevealInView: QuickInputButton = {
export const RevealInSideBar: QuickInputButton = {
iconPath: new ThemeIcon('eye'),
tooltip: 'Reveal in Side Bar',
};
export const ShowInView: QuickInputButton = {
export const SearchInSideBar: QuickInputButton = {
iconPath: new ThemeIcon('search'),
tooltip: 'Show in Search Commits View',
tooltip: 'Search in Side Bar',
};
export const ShowResultsInView: QuickInputButton = {
export const ShowResultsInSideBar: QuickInputButton = {
iconPath: new ThemeIcon('search'),
tooltip: 'Show Results in Search Commits View',
tooltip: 'Show Results in Side Bar',
};
export const ShowResultsInViewToggle = class extends ToggleQuickInputButton {
export const ShowResultsToggle = class extends ToggleQuickInputButton {
constructor(on = false, onDidClick?: (quickInput: QuickInput) => void) {
super(
() => ({
on: {
tooltip: 'Show Results in Search Commits View',
tooltip: 'Show Results in Side Bar',
icon: {
dark: Uri.file(Container.context.asAbsolutePath('images/dark/icon-window.svg')),
light: Uri.file(Container.context.asAbsolutePath('images/light/icon-window.svg')),

+ 147
- 137
src/commands/quickCommand.steps.ts View File

@ -40,6 +40,9 @@ import {
BranchQuickPickItem,
CommandQuickPickItem,
CommitApplyFileChangesCommandQuickPickItem,
CommitBrowseRepositoryFromHereCommandQuickPickItem,
CommitCompareWithHEADCommandQuickPickItem,
CommitCompareWithWorkingCommandQuickPickItem,
CommitCopyIdQuickPickItem,
CommitCopyMessageQuickPickItem,
CommitFileQuickPickItem,
@ -64,11 +67,11 @@ import {
DirectiveQuickPickItem,
GitCommandQuickPickItem,
OpenChangedFilesCommandQuickPickItem,
OpenInSearchCommitsViewQuickPickItem,
OpenRemoteResourceCommandQuickPickItem,
ReferencesQuickPickItem,
RepositoryQuickPickItem,
RevealInRepositoriesViewQuickPickItem,
RevealInSideBarQuickPickItem,
SearchForCommitQuickPickItem,
TagQuickPickItem,
} from '../quickpicks';
import { Arrays, Iterables, Strings } from '../system';
@ -371,9 +374,9 @@ export async function* pickBranchStep<
branches.length === 0
? [DirectiveQuickPickItem.create(Directive.Back, true), DirectiveQuickPickItem.create(Directive.Cancel)]
: branches,
additionalButtons: [QuickCommandButtons.RevealInView],
additionalButtons: [QuickCommandButtons.RevealInSideBar],
onDidClickButton: (quickpick, button) => {
if (button === QuickCommandButtons.RevealInView) {
if (button === QuickCommandButtons.RevealInSideBar) {
if (quickpick.activeItems.length === 0) {
void Container.repositoriesView.revealBranches(state.repo.path, {
select: true,
@ -436,9 +439,9 @@ export async function* pickBranchesStep<
branches.length === 0
? [DirectiveQuickPickItem.create(Directive.Back, true), DirectiveQuickPickItem.create(Directive.Cancel)]
: branches,
additionalButtons: [QuickCommandButtons.RevealInView],
additionalButtons: [QuickCommandButtons.RevealInSideBar],
onDidClickButton: (quickpick, button) => {
if (button === QuickCommandButtons.RevealInView) {
if (button === QuickCommandButtons.RevealInSideBar) {
if (quickpick.activeItems.length === 0) {
void Container.repositoriesView.revealBranches(state.repo.path, {
select: true,
@ -521,7 +524,7 @@ export async function* pickBranchOrTagStep<
branchesAndOrTags.length === 0
? [DirectiveQuickPickItem.create(Directive.Back, true), DirectiveQuickPickItem.create(Directive.Cancel)]
: branchesAndOrTags,
additionalButtons: [QuickCommandButtons.RevealInView, ...(additionalButtons ?? []), showTagsButton],
additionalButtons: [QuickCommandButtons.RevealInSideBar, ...(additionalButtons ?? []), showTagsButton],
onDidClickButton: async (quickpick, button) => {
if (button === showTagsButton) {
quickpick.busy = true;
@ -547,7 +550,7 @@ export async function* pickBranchOrTagStep<
return;
}
if (button === QuickCommandButtons.RevealInView) {
if (button === QuickCommandButtons.RevealInSideBar) {
if (quickpick.activeItems.length === 0) {
void Container.repositoriesView.revealBranches(state.repo.path, {
select: true,
@ -637,7 +640,7 @@ export async function* pickBranchOrTagStepMultiRepo<
branchesAndOrTags.length === 0
? [DirectiveQuickPickItem.create(Directive.Back, true), DirectiveQuickPickItem.create(Directive.Cancel)]
: branchesAndOrTags,
additionalButtons: [QuickCommandButtons.RevealInView, showTagsButton],
additionalButtons: [QuickCommandButtons.RevealInSideBar, showTagsButton],
onDidClickButton: async (quickpick, button) => {
if (button === showTagsButton) {
quickpick.busy = true;
@ -661,7 +664,7 @@ export async function* pickBranchOrTagStepMultiRepo<
}
}
if (button === QuickCommandButtons.RevealInView) {
if (button === QuickCommandButtons.RevealInSideBar) {
if (quickpick.activeItems.length === 0) {
if (state.repos.length === 1) {
void Container.repositoriesView.revealBranches(state.repos[0].path, {
@ -715,7 +718,7 @@ export function* pickCommitStep<
onDidLoadMore,
picked,
placeholder,
showInViewButton: showInView,
showInSideBarButton: showInSideBar,
titleContext,
}: {
ignoreFocusOut?: boolean;
@ -723,7 +726,7 @@ export function* pickCommitStep<
onDidLoadMore?: (log: GitLog | undefined) => void;
picked?: string | string[] | undefined;
placeholder: string | ((context: Context, log: GitLog | undefined) => string);
showInViewButton?: {
showInSideBarButton?: {
button: QuickInputButton;
onDidClick: (items: Readonly<CommitQuickPickItem<GitLogCommit>[]>) => void;
};
@ -763,22 +766,22 @@ export function* pickCommitStep<
return getItems(log);
},
additionalButtons: [
QuickCommandButtons.RevealInView,
showInView?.button ?? QuickCommandButtons.ShowInView,
QuickCommandButtons.RevealInSideBar,
showInSideBar?.button ?? QuickCommandButtons.SearchInSideBar,
...(log?.hasMore ? [QuickCommandButtons.LoadMore] : []),
],
onDidClickButton: (quickpick, button) => {
if (log == null) return;
if (button === showInView?.button) {
showInView.onDidClick(quickpick.activeItems);
if (button === showInSideBar?.button) {
showInSideBar.onDidClick(quickpick.activeItems);
return;
}
if (quickpick.activeItems.length === 0 || log == null) return;
if (button === QuickCommandButtons.RevealInView) {
if (button === QuickCommandButtons.RevealInSideBar) {
void GitActions.Commit.reveal(quickpick.activeItems[0].item, {
select: true,
focus: false,
@ -788,7 +791,7 @@ export function* pickCommitStep<
return;
}
if (button === QuickCommandButtons.ShowInView) {
if (button === QuickCommandButtons.SearchInSideBar) {
void Container.searchView.search(
state.repo.path,
{ pattern: SearchPattern.fromCommit(quickpick.activeItems[0].item.ref) },
@ -890,14 +893,14 @@ export function* pickCommitsStep<
return getItems(log);
},
additionalButtons: [
QuickCommandButtons.RevealInView,
QuickCommandButtons.ShowInView,
QuickCommandButtons.RevealInSideBar,
QuickCommandButtons.SearchInSideBar,
...(log?.hasMore ? [QuickCommandButtons.LoadMore] : []),
],
onDidClickButton: (quickpick, button) => {
if (quickpick.activeItems.length === 0 || log == null) return;
if (button === QuickCommandButtons.RevealInView) {
if (button === QuickCommandButtons.RevealInSideBar) {
void GitActions.Commit.reveal(quickpick.activeItems[0].item, {
select: true,
focus: false,
@ -907,7 +910,7 @@ export function* pickCommitsStep<
return;
}
if (button === QuickCommandButtons.ShowInView) {
if (button === QuickCommandButtons.SearchInSideBar) {
void Container.searchView.search(
state.repo.path,
{ pattern: SearchPattern.fromCommit(quickpick.activeItems[0].item.ref) },
@ -1000,9 +1003,9 @@ export async function* pickRepositoryStep<
}),
),
),
additionalButtons: [QuickCommandButtons.RevealInView],
additionalButtons: [QuickCommandButtons.RevealInSideBar],
onDidClickButton: (quickpick, button) => {
if (button === QuickCommandButtons.RevealInView) {
if (button === QuickCommandButtons.RevealInSideBar) {
if (quickpick.activeItems.length === 0) return;
void Container.repositoriesView.revealRepository(quickpick.activeItems[0].item.path, {
@ -1071,9 +1074,9 @@ export async function* pickRepositoriesStep<
),
),
),
additionalButtons: [QuickCommandButtons.RevealInView],
additionalButtons: [QuickCommandButtons.RevealInSideBar],
onDidClickButton: (quickpick, button) => {
if (button === QuickCommandButtons.RevealInView) {
if (button === QuickCommandButtons.RevealInSideBar) {
if (quickpick.activeItems.length === 0) return;
void Container.repositoriesView.revealRepository(quickpick.activeItems[0].item.path, {
@ -1136,9 +1139,9 @@ export function* pickStashStep<
),
),
],
additionalButtons: [QuickCommandButtons.RevealInView, QuickCommandButtons.ShowInView],
additionalButtons: [QuickCommandButtons.RevealInSideBar, QuickCommandButtons.SearchInSideBar],
onDidClickButton: (quickpick, button) => {
if (button === QuickCommandButtons.RevealInView) {
if (button === QuickCommandButtons.RevealInSideBar) {
if (quickpick.activeItems.length === 0) {
void Container.repositoriesView.revealStashes(state.repo.path, {
select: true,
@ -1155,7 +1158,7 @@ export function* pickStashStep<
return;
}
if (button === QuickCommandButtons.ShowInView) {
if (button === QuickCommandButtons.SearchInSideBar) {
if (quickpick.activeItems.length === 0) return;
void Container.searchView.search(
@ -1221,9 +1224,9 @@ export async function* pickTagsStep<
tags.length === 0
? [DirectiveQuickPickItem.create(Directive.Back, true), DirectiveQuickPickItem.create(Directive.Cancel)]
: tags,
additionalButtons: [QuickCommandButtons.RevealInView],
additionalButtons: [QuickCommandButtons.RevealInSideBar],
onDidClickButton: (quickpick, button) => {
if (button === QuickCommandButtons.RevealInView) {
if (button === QuickCommandButtons.RevealInSideBar) {
if (quickpick.activeItems.length === 0) {
void Container.repositoriesView.revealTags(state.repo.path, {
select: true,
@ -1276,10 +1279,10 @@ export async function* showCommitOrStashStep<
ignoreFocusOut: true,
items: await getShowCommitOrStashStepItems(state),
additionalButtons: GitReference.isStash(state.reference)
? [QuickCommandButtons.RevealInView]
: [QuickCommandButtons.RevealInView, QuickCommandButtons.ShowInView],
? [QuickCommandButtons.RevealInSideBar]
: [QuickCommandButtons.RevealInSideBar, QuickCommandButtons.SearchInSideBar],
onDidClickButton: (quickpick, button) => {
if (button === QuickCommandButtons.ShowInView) {
if (button === QuickCommandButtons.SearchInSideBar) {
void Container.searchView.search(
state.repo.path,
{ pattern: SearchPattern.fromCommit(state.reference.ref) },
@ -1296,7 +1299,7 @@ export async function* showCommitOrStashStep<
return;
}
if (button === QuickCommandButtons.RevealInView) {
if (button === QuickCommandButtons.RevealInSideBar) {
if (GitReference.isStash(state.reference)) {
void GitActions.Stash.reveal(state.reference, {
select: true,
@ -1353,39 +1356,73 @@ async function getShowCommitOrStashStepItems<
reference: state.reference,
},
}),
new RevealInRepositoriesViewQuickPickItem(state.reference),
new RevealInSideBarQuickPickItem(state.reference),
);
} else {
remotes = await Container.git.getRemotes(state.repo.path, { sort: true });
if (
branch != null &&
(await Container.git.branchContainsCommit(state.repo.path, branch.name, state.reference.ref))
) {
items.push(
new GitCommandQuickPickItem('Revert Commit...', {
command: 'revert',
state: {
repo: state.repo,
references: [state.reference],
},
}),
new GitCommandQuickPickItem('Reset Commit...', {
command: 'reset',
state: {
repo: state.repo,
reference: GitReference.create(`${state.reference.ref}^`, state.reference.repoPath, {
refType: 'revision',
name: `${state.reference.name}^`,
message: state.reference.message,
}),
},
}),
new GitCommandQuickPickItem(`Reset ${branch?.name ?? 'Current Branch'} to Commit...`, {
command: 'reset',
state: {
repo: state.repo,
reference: state.reference,
},
}),
new GitCommandQuickPickItem('Push to Commit...', {
command: 'push',
state: {
repos: state.repo,
reference: state.reference,
},
}),
);
} else {
items.push(
new GitCommandQuickPickItem('Cherry Pick Commit...', {
command: 'cherry-pick',
state: {
repo: state.repo,
references: [state.reference],
},
}),
);
}
items.push(
new GitCommandQuickPickItem('Checkout Commit...', {
command: 'switch',
state: {
repos: [state.repo],
reference: state.reference,
},
}),
);
items.push(
new GitCommandQuickPickItem('Revert Commit...', {
command: 'revert',
state: {
repo: state.repo,
references: [state.reference],
},
}),
new GitCommandQuickPickItem(`Reset ${branch?.name ?? 'HEAD'} to Commit...`, {
command: 'reset',
new GitCommandQuickPickItem(`Rebase ${branch?.name ?? 'Current Branch'} onto Commit...`, {
command: 'rebase',
state: {
repo: state.repo,
reference: state.reference,
},
}),
new GitCommandQuickPickItem(`Rebase ${branch?.name ?? 'HEAD'} onto Commit...`, {
command: 'rebase',
new GitCommandQuickPickItem('Switch to Commit...', {
command: 'switch',
state: {
repo: state.repo,
repos: [state.repo],
reference: state.reference,
},
}),
@ -1405,8 +1442,6 @@ async function getShowCommitOrStashStepItems<
reference: state.reference,
},
}),
new RevealInRepositoriesViewQuickPickItem(state.reference),
new OpenInSearchCommitsViewQuickPickItem(state.reference),
);
}
@ -1431,12 +1466,28 @@ async function getShowCommitOrStashStepItems<
);
}
// TODO@eamodio add Browse Repository at Revision
// TODO@eamodio add Compare with HEAD
// TODO@eamodio add Compare with Working Tree options
items.push(new RevealInSideBarQuickPickItem(state.reference));
if (!isStash) {
items.push(new CommitCopyIdQuickPickItem(state.reference));
if (isStash) {
items.push(
new CommitBrowseRepositoryFromHereCommandQuickPickItem(state.reference, false),
new CommitBrowseRepositoryFromHereCommandQuickPickItem(state.reference, true),
new CommitCompareWithHEADCommandQuickPickItem(state.reference),
new CommitCompareWithWorkingCommandQuickPickItem(state.reference),
);
} else {
items.push(
new SearchForCommitQuickPickItem(state.reference),
new CommitBrowseRepositoryFromHereCommandQuickPickItem(state.reference, false),
new CommitBrowseRepositoryFromHereCommandQuickPickItem(state.reference, true),
new CommitCompareWithHEADCommandQuickPickItem(state.reference),
new CommitCompareWithWorkingCommandQuickPickItem(state.reference),
new CommitCopyIdQuickPickItem(state.reference),
);
}
items.push(new CommitCopyMessageQuickPickItem(state.reference));
@ -1484,9 +1535,9 @@ export async function* showCommitOrStashFilesStep<
),
],
matchOnDescription: true,
additionalButtons: [QuickCommandButtons.RevealInView, QuickCommandButtons.ShowInView],
additionalButtons: [QuickCommandButtons.RevealInSideBar, QuickCommandButtons.SearchInSideBar],
onDidClickButton: (quickpick, button) => {
if (button === QuickCommandButtons.ShowInView) {
if (button === QuickCommandButtons.SearchInSideBar) {
void Container.searchView.search(
state.repo.path,
{ pattern: SearchPattern.fromCommit(state.reference.ref) },
@ -1503,7 +1554,7 @@ export async function* showCommitOrStashFilesStep<
return;
}
if (button === QuickCommandButtons.RevealInView) {
if (button === QuickCommandButtons.RevealInSideBar) {
if (GitReference.isStash(state.reference)) {
void GitActions.Stash.reveal(state.reference, {
select: true,
@ -1556,9 +1607,9 @@ export async function* showCommitOrStashFileStep<
ignoreFocusOut: true,
items: await getShowCommitOrStashFileStepItems(state),
matchOnDescription: true,
additionalButtons: [QuickCommandButtons.RevealInView, QuickCommandButtons.ShowInView],
additionalButtons: [QuickCommandButtons.RevealInSideBar, QuickCommandButtons.SearchInSideBar],
onDidClickButton: (quickpick, button) => {
if (button === QuickCommandButtons.ShowInView) {
if (button === QuickCommandButtons.SearchInSideBar) {
void Container.searchView.search(
state.repo.path,
{ pattern: SearchPattern.fromCommit(state.reference.ref) },
@ -1575,7 +1626,7 @@ export async function* showCommitOrStashFileStep<
return;
}
if (button === QuickCommandButtons.RevealInView) {
if (button === QuickCommandButtons.RevealInSideBar) {
if (GitReference.isStash(state.reference)) {
void GitActions.Stash.reveal(state.reference, {
select: true,
@ -1616,77 +1667,16 @@ async function getShowCommitOrStashFileStepItems<
let remotes: GitRemote<RemoteProvider>[] | undefined;
items.push(
new CommitApplyFileChangesCommandQuickPickItem(state.reference, file),
new CommitRestoreFileChangesCommandQuickPickItem(state.reference, file),
new RevealInRepositoriesViewQuickPickItem(state.reference),
);
let isStash = false;
if (GitStashCommit.is(state.reference)) {
isStash = true;
} else {
remotes = await Container.git.getRemotes(state.repo.path, { sort: true });
// TODO@eamodio Show commit actions here?
// items.push(
// new GitCommandQuickPickItem('Checkout Commit...', {
// command: 'switch',
// state: {
// repos: [state.repo],
// reference: state.reference,
// },
// }),
// );
// items.push(
// new GitCommandQuickPickItem('Revert Commit...', {
// command: 'revert',
// state: {
// repo: state.repo,
// references: [state.reference],
// },
// }),
// );
// items.push(
// new GitCommandQuickPickItem(`Reset ${branch?.name ?? 'HEAD'} to Commit...`, {
// command: 'reset',
// state: {
// repo: state.repo,
// reference: state.reference,
// },
// }),
// );
// items.push(
// new GitCommandQuickPickItem(`Rebase ${branch?.name ?? 'HEAD'} onto Commit...`, {
// command: 'rebase',
// state: {
// repo: state.repo,
// reference: state.reference,
// },
// }),
// );
// items.push(
// new GitCommandQuickPickItem('Create Branch at Commit...', {
// command: 'branch',
// state: {
// subcommand: 'create',
// repo: state.repo,
// reference: state.reference,
// },
// }),
// );
// items.push(
// new GitCommandQuickPickItem('Create Tag at Commit...', {
// command: 'tag',
// state: {
// subcommand: 'create',
// repo: state.repo,
// reference: state.reference,
// },
// }),
// );
items.push(new OpenInSearchCommitsViewQuickPickItem(state.reference));
items.push(
new CommitApplyFileChangesCommandQuickPickItem(state.reference, file),
new CommitRestoreFileChangesCommandQuickPickItem(state.reference, file),
);
}
items.push(
@ -1714,8 +1704,28 @@ async function getShowCommitOrStashFileStepItems<
);
}
if (!isStash) {
items.push(new CommitCopyIdQuickPickItem(state.reference));
items.push(new RevealInSideBarQuickPickItem(state.reference));
if (isStash) {
items.push(
new CommitBrowseRepositoryFromHereCommandQuickPickItem(state.reference, false),
new CommitBrowseRepositoryFromHereCommandQuickPickItem(state.reference, true),
new CommitCompareWithHEADCommandQuickPickItem(state.reference),
new CommitCompareWithWorkingCommandQuickPickItem(state.reference),
);
} else {
items.push(
new SearchForCommitQuickPickItem(state.reference),
new CommitBrowseRepositoryFromHereCommandQuickPickItem(state.reference, false),
new CommitBrowseRepositoryFromHereCommandQuickPickItem(state.reference, true),
new CommitCompareWithHEADCommandQuickPickItem(state.reference),
new CommitCompareWithWorkingCommandQuickPickItem(state.reference),
new CommitCopyIdQuickPickItem(state.reference),
);
}
items.push(new CommitCopyMessageQuickPickItem(state.reference));

+ 4
- 4
src/commands/searchCommits.ts View File

@ -10,7 +10,7 @@ export interface SearchCommitsCommandArgs {
prefillOnly?: boolean;
showInView?: boolean;
showResultsInSideBar?: boolean;
}
@command()
@ -22,7 +22,7 @@ export class SearchCommitsCommand extends Command {
protected preExecute(context: CommandContext, args?: SearchCommitsCommandArgs) {
if (context.type === 'viewItem') {
args = { ...args };
args.showInView = true;
args.showResultsInSideBar = true;
if (context.node instanceof SearchResultsCommitsNode) {
args.repoPath = context.node.repoPath;
@ -35,7 +35,7 @@ export class SearchCommitsCommand extends Command {
}
} else if (context.command === Commands.SearchCommitsInView) {
args = { ...args };
args.showInView = true;
args.showResultsInSideBar = true;
}
return this.execute(args);
@ -48,7 +48,7 @@ export class SearchCommitsCommand extends Command {
state: {
repo: args?.repoPath,
...args?.search,
showResultsInView: args?.showInView,
showResultsInSideBar: args?.showResultsInSideBar,
},
}));
}

+ 3
- 5
src/commands/showCommitsInView.ts View File

@ -42,9 +42,7 @@ export class ShowCommitsInViewCommand extends ActiveEditorCommand {
)
: await Container.git.getBlameForRange(gitUri, editor.selection);
if (blame === undefined) {
return Messages.showFileNotUnderSourceControlWarningMessage(
'Unable to show commits in Search Commits view',
);
return Messages.showFileNotUnderSourceControlWarningMessage('Unable to find commits');
}
args.refs = [
@ -52,7 +50,7 @@ export class ShowCommitsInViewCommand extends ActiveEditorCommand {
];
} catch (ex) {
Logger.error(ex, 'ShowCommitsInViewCommand', 'getBlameForRange');
return Messages.showGenericErrorMessage('Unable to show commits in Search Commits view');
return Messages.showGenericErrorMessage('Unable to find commits');
}
} else {
if (gitUri.sha == null) return undefined;
@ -66,7 +64,7 @@ export class ShowCommitsInViewCommand extends ActiveEditorCommand {
state: {
repo: args?.repoPath,
pattern: SearchPattern.fromCommits(args.refs),
showResultsInView: true,
showResultsInSideBar: true,
},
});
}

+ 3
- 3
src/commands/showQuickFileHistory.ts View File

@ -12,7 +12,7 @@ export interface ShowQuickFileHistoryCommandArgs {
log?: GitLog;
limit?: number;
range?: Range;
showInView?: boolean;
showInSideBar?: boolean;
goBackCommand?: CommandQuickPickItem;
nextPageCommand?: CommandQuickPickItem;
@ -27,7 +27,7 @@ export class ShowQuickFileHistoryCommand extends ActiveEditorCachedCommand {
protected preExecute(context: CommandContext, args?: ShowQuickFileHistoryCommandArgs) {
if (context.command === Commands.ShowFileHistoryInView) {
args = { ...args };
args.showInView = true;
args.showInSideBar = true;
}
return this.execute(context.editor, context.uri, args);
@ -39,7 +39,7 @@ export class ShowQuickFileHistoryCommand extends ActiveEditorCachedCommand {
const gitUri = await GitUri.fromUri(uri);
if (args?.showInView) {
if (args?.showInSideBar) {
await Container.fileHistoryView.showHistoryForUri(gitUri);
return;

+ 1
- 1
src/config.ts View File

@ -46,7 +46,7 @@ export interface Config {
matchAll: boolean;
matchCase: boolean;
matchRegex: boolean;
showResultsInView: boolean;
showResultsInSideBar: boolean;
};
skipConfirmations: string[];
};

+ 10
- 3
src/git/git.ts View File

@ -373,14 +373,21 @@ export namespace Git {
);
}
export function branch__contains(repoPath: string, ref: string, { remotes = false }: { remotes?: boolean } = {}) {
export function branch__contains(
repoPath: string,
ref: string,
{ name = undefined, remotes = false }: { name?: string; remotes?: boolean } = {},
) {
const params = ['branch'];
if (remotes) {
params.push('-r');
}
params.push('--contains');
params.push('--contains', ref);
if (name != null) {
params.push(name);
}
return git<string>({ cwd: repoPath, configs: ['-c', 'color.branch=false'] }, ...params, ref);
return git<string>({ cwd: repoPath, configs: ['-c', 'color.branch=false'] }, ...params);
}
export function check_ignore(repoPath: string, ...files: string[]) {

+ 7
- 0
src/git/gitService.ts View File

@ -516,6 +516,13 @@ export class GitService implements Disposable {
}
@log()
async branchContainsCommit(repoPath: string, name: string, ref: string): Promise<boolean> {
let data = await Git.branch__contains(repoPath, ref, { name: name });
data = data?.trim();
return Boolean(data);
}
@log()
async checkout(repoPath: string, ref: string, options: { createBranch?: string } | { fileName?: string } = {}) {
const cc = Logger.getCorrelationContext();

+ 35
- 0
src/quickpicks/commitQuickPickItems.ts View File

@ -2,6 +2,7 @@
import * as paths from 'path';
import { QuickPickItem, window } from 'vscode';
import { Commands, GitActions, OpenChangedFilesCommandArgs } from '../commands';
import { Container } from '../container';
import { CommitFormatter, GitFile, GitLogCommit, GitStatusFile } from '../git/git';
import { Keys } from '../keyboard';
import { CommandQuickPickItem } from './quickPicksItems';
@ -65,6 +66,40 @@ export class CommitFileQuickPickItem extends CommandQuickPickItem {
}
}
export class CommitBrowseRepositoryFromHereCommandQuickPickItem extends CommandQuickPickItem {
constructor(
private readonly commit: GitLogCommit,
private readonly openInNewWindow: boolean,
item?: QuickPickItem,
) {
super(item ?? `$(folder-opened) Browse Repository from Here${openInNewWindow ? ' in New Window' : ''}`);
}
execute(_options: { preserveFocus?: boolean; preview?: boolean }): Promise<void> {
return GitActions.browseAtRevision(this.commit.toGitUri(), { openInNewWindow: this.openInNewWindow });
}
}
export class CommitCompareWithHEADCommandQuickPickItem extends CommandQuickPickItem {
constructor(private readonly commit: GitLogCommit, item?: QuickPickItem) {
super(item ?? '$(compare-changes) Compare with HEAD');
}
execute(_options: { preserveFocus?: boolean; preview?: boolean }): Promise<void> {
return Container.compareView.compare(this.commit.repoPath, this.commit.ref, 'HEAD');
}
}
export class CommitCompareWithWorkingCommandQuickPickItem extends CommandQuickPickItem {
constructor(private readonly commit: GitLogCommit, item?: QuickPickItem) {
super(item ?? '$(compare-changes) Compare with Working Tree');
}
execute(_options: { preserveFocus?: boolean; preview?: boolean }): Promise<void> {
return Container.compareView.compare(this.commit.repoPath, this.commit.ref, '');
}
}
export class CommitCopyIdQuickPickItem extends CommandQuickPickItem {
constructor(private readonly commit: GitLogCommit, item?: QuickPickItem) {
super(item ?? '$(clippy) Copy Commit ID');

+ 30
- 31
src/quickpicks/quickPicksItems.ts View File

@ -170,12 +170,39 @@ function hasFlags(flags: T[], has?: T | T[]): boolean {
return has.length === 0 ? flags.length === 0 : has.every(f => flags.includes(f));
}
export class OpenInSearchCommitsViewQuickPickItem extends CommandQuickPickItem {
export class RevealInSideBarQuickPickItem extends CommandQuickPickItem {
constructor(
private readonly reference: GitRevisionReference,
item: QuickPickItem = {
label: '$(search) Show Commit',
description: 'in Search Commits view',
label: `$(eye) Reveal ${GitReference.isStash(reference) ? 'Stash' : 'Commit'} in Side Bar`,
description: GitReference.isStash(reference) ? '' : 'can take a while',
},
) {
super(item, undefined, undefined);
}
async execute(options?: { preserveFocus?: boolean; preview?: boolean }): Promise<void> {
if (GitStashCommit.is(this.reference)) {
void (await GitActions.Stash.reveal(this.reference, {
select: true,
focus: !(options?.preserveFocus ?? false),
expand: true,
}));
} else {
void (await GitActions.Commit.reveal(this.reference, {
select: true,
focus: !(options?.preserveFocus ?? false),
expand: true,
}));
}
}
}
export class SearchForCommitQuickPickItem extends CommandQuickPickItem {
constructor(
private readonly reference: GitRevisionReference,
item: QuickPickItem = {
label: '$(search) Search for Commit in Side Bar',
},
) {
super(item, undefined, undefined);
@ -200,31 +227,3 @@ export class OpenInSearchCommitsViewQuickPickItem extends CommandQuickPickItem {
));
}
}
export class RevealInRepositoriesViewQuickPickItem extends CommandQuickPickItem {
constructor(
private readonly reference: GitRevisionReference,
item: QuickPickItem = {
label: `$(eye) Reveal ${GitReference.isStash(reference) ? 'Stash' : 'Commit'}`,
description: GitReference.isStash(reference) ? '' : 'can take a while',
},
) {
super(item, undefined, undefined);
}
async execute(options?: { preserveFocus?: boolean; preview?: boolean }): Promise<void> {
if (GitStashCommit.is(this.reference)) {
void (await GitActions.Stash.reveal(this.reference, {
select: true,
focus: !(options?.preserveFocus ?? false),
expand: true,
}));
} else {
void (await GitActions.Commit.reveal(this.reference, {
select: true,
focus: !(options?.preserveFocus ?? false),
expand: true,
}));
}
}
}

+ 2
- 2
src/statusbar/statusBarController.ts View File

@ -155,13 +155,13 @@ export class StatusBarController implements Disposable {
this._blameStatusBarItem.tooltip = 'Reveal Commit in the Side Bar';
break;
case StatusBarCommand.ShowCommitsInView:
this._blameStatusBarItem.tooltip = 'Show Commit in Search Commits View';
this._blameStatusBarItem.tooltip = 'Search for Commit in the Side Bar';
break;
case StatusBarCommand.ShowQuickCommitDetails:
this._blameStatusBarItem.tooltip = 'Show Commit';
break;
case StatusBarCommand.ShowQuickCommitFileDetails:
this._blameStatusBarItem.tooltip = 'Show Commit';
this._blameStatusBarItem.tooltip = 'Show Commit (file)';
break;
case StatusBarCommand.ShowQuickFileHistory:
this._blameStatusBarItem.tooltip = 'Show File History';

+ 1
- 1
src/views/nodes/searchResultsCommitsNode.ts View File

@ -50,7 +50,7 @@ export class SearchResultsCommitsNode extends ResultsCommitsNode {
const args: SearchCommitsCommandArgs = {
search: this.search,
prefillOnly: true,
showInView: true,
showResultsInSideBar: true,
};
item.command = {
title: 'Search Commits',

+ 4
- 4
src/webviews/apps/settings/partials/code-lens.html View File

@ -73,10 +73,10 @@
opens changes with the previous revision
</option>
<option value="gitlens.revealCommitInView">
reveals the commit in the side bar
reveals the commit in the Side Bar
</option>
<option value="gitlens.showCommitsInView">
shows the commit in the Search Commits view
searches for the commit in the Side Bar
</option>
<option value="gitlens.showQuickCommitDetails">
shows details of the commit
@ -138,10 +138,10 @@
opens changes with the previous revision
</option>
<option value="gitlens.revealCommitInView">
reveals the commit in the side bar
reveals the commit in the Side Bar
</option>
<option value="gitlens.showCommitsInView">
shows the commits within the range in the Search Commits view
searches for the commits within the range in the Side Bar
</option>
<option value="gitlens.showQuickCommitDetails">
shows details of the commit

+ 2
- 2
src/webviews/apps/settings/partials/status-bar.html View File

@ -64,10 +64,10 @@
opens line changes with the working file
</option>
<option value="gitlens.revealCommitInView">
reveals the commit in the side bar
reveals the commit in the Side Bar
</option>
<option value="gitlens.showCommitsInView">
shows the commit in the Search Commits view
searches for the commit in the Side Bar
</option>
<option value="gitlens.toggleCodeLens">toggles the Git code lens</option>
<option value="gitlens.showQuickCommitDetails">shows details of the commit</option>

Loading…
Cancel
Save