Pārlūkot izejas kodu

Renames show commit search to search commits

Adds search commits button to view
main
Eric Amodio pirms 6 gadiem
vecāks
revīzija
3f8923c8f6
7 mainītis faili ar 267 papildinājumiem un 244 dzēšanām
  1. +1
    -1
      README.md
  2. +18
    -0
      package.json
  3. +1
    -1
      src/commands.ts
  4. +2
    -1
      src/commands/common.ts
  5. +12
    -8
      src/commands/searchCommits.ts
  6. +7
    -7
      src/views/nodes/searchNode.ts

+ 1
- 1
README.md Parādīt failu

@ -267,7 +267,7 @@ The search commits view provides the following features,
- Provides a semi-persistent results view for searching and exploring commit histories
- Accessible via the following commands
- _Show Commit Search_ command (`gitlens.showCommitSearch`)
- _Search Commits_ command (`gitlens.showCommitSearch`)
- _Show File History_ command (`gitlens.showQuickFileHistory`)
- _Show Commit Details_ command (`gitlens.showQuickCommitDetails`)
- An inline toolbar provides a _Clear Results_ command

+ 18
- 0
package.json Parādīt failu

@ -2429,6 +2429,15 @@
}
},
{
"command": "gitlens.views.search.searchCommits",
"title": "Search Commits",
"category": "GitLens",
"icon": {
"dark": "images/dark/icon-search.svg",
"light": "images/light/icon-search.svg"
}
},
{
"command": "gitlens.views.search.clear",
"title": "Clear Results",
"category": "GitLens",
@ -3013,6 +3022,10 @@
"when": "false"
},
{
"command": "gitlens.views.search.searchCommits",
"when": "false"
},
{
"command": "gitlens.views.search.clear",
"when": "false"
},
@ -3421,6 +3434,11 @@
"group": "1_gitlens"
},
{
"command": "gitlens.views.search.searchCommits",
"when": "view =~ /^gitlens\\.views\\.search:/",
"group": "navigation@1"
},
{
"command": "gitlens.views.search.clear",
"when": "view =~ /^gitlens\\.views\\.search:/",
"group": "navigation@2"

+ 1
- 1
src/commands.ts Parādīt failu

@ -28,7 +28,7 @@ export * from './commands/openRepoInRemote';
export * from './commands/openWorkingFile';
export * from './commands/repositories';
export * from './commands/resetSuppressedWarnings';
export * from './commands/showCommitSearch';
export * from './commands/searchCommits';
export * from './commands/showLastQuickPick';
export * from './commands/showQuickBranchHistory';
export * from './commands/showQuickCommitDetails';

+ 2
- 1
src/commands/common.ts Parādīt failu

@ -57,7 +57,8 @@ export enum Commands {
PushRepositories = 'gitlens.pushRepositories',
ResetSuppressedWarnings = 'gitlens.resetSuppressedWarnings',
ShowCommitInView = 'gitlens.showCommitInView',
ShowCommitSearch = 'gitlens.showCommitSearch',
SearchCommits = 'gitlens.showCommitSearch',
SearchCommitsInView = 'gitlens.views.search.searchCommits',
ShowCompareView = 'gitlens.showCompareView',
ShowFileHistoryView = 'gitlens.showFileHistoryView',
ShowFileHistoryInView = 'gitlens.showFileHistoryInView',

src/commands/showCommitSearch.ts → src/commands/searchCommits.ts Parādīt failu

@ -35,7 +35,7 @@ const searchByToSymbolMap = new Map([
[GitRepoSearchBy.Sha, '#']
]);
export interface ShowCommitSearchCommandArgs {
export interface SearchCommitsCommandArgs {
search?: string;
searchBy?: GitRepoSearchBy;
maxCount?: number;
@ -45,12 +45,12 @@ export interface ShowCommitSearchCommandArgs {
}
@command()
export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
export class SearchCommitsCommand extends ActiveEditorCachedCommand {
constructor() {
super(Commands.ShowCommitSearch);
super([Commands.SearchCommits, Commands.SearchCommitsInView]);
}
protected async preExecute(context: CommandContext, args: ShowCommitSearchCommandArgs = {}) {
protected async preExecute(context: CommandContext, args: SearchCommitsCommandArgs = {}) {
if (context.type === 'viewItem') {
args = { ...args };
args.showInView = true;
@ -59,6 +59,10 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
return this.execute(context.editor, context.node.uri, args);
}
}
else if (context.command === Commands.SearchCommitsInView) {
args = { ...args };
args.showInView = true;
}
else {
// TODO: Add a user setting (default to view?)
}
@ -66,7 +70,7 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
return this.execute(context.editor, context.uri, args);
}
async execute(editor?: TextEditor, uri?: Uri, args: ShowCommitSearchCommandArgs = {}) {
async execute(editor?: TextEditor, uri?: Uri, args: SearchCommitsCommandArgs = {}) {
uri = getCommandUri(uri, editor);
const gitUri = uri && (await GitUri.fromUri(uri));
@ -173,7 +177,7 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
label: `go back ${GlyphChars.ArrowBack}`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} to commit search`
},
Commands.ShowCommitSearch,
Commands.SearchCommits,
[uri, originalArgs]
);
@ -188,7 +192,7 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
label: `$(sync) Show All Commits`,
description: `${Strings.pad(GlyphChars.Dash, 2, 3)} this may take a while`
},
Commands.ShowCommitSearch,
Commands.SearchCommits,
[uri, { ...args, maxCount: 0, goBackCommand: goBackCommand }]
)
: undefined,
@ -218,7 +222,7 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
label: `go back ${GlyphChars.ArrowBack}`,
description: `${Strings.pad(GlyphChars.Dash, 2, 2)} to search for ${searchLabel}`
},
Commands.ShowCommitSearch,
Commands.SearchCommits,
[uri, args]
)
} as ShowQuickCommitDetailsCommandArgs);

+ 7
- 7
src/views/nodes/searchNode.ts Parādīt failu

@ -1,6 +1,6 @@
'use strict';
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
import { ShowCommitSearchCommandArgs } from '../../commands';
import { SearchCommitsCommandArgs } from '../../commands';
import { GlyphChars } from '../../constants';
import { GitRepoSearchBy } from '../../git/gitService';
import { debug, Functions, gate, log } from '../../system';
@ -28,7 +28,7 @@ export class SearchNode extends ViewNode {
this,
{
...command,
arguments: [this, { searchBy: GitRepoSearchBy.Message } as ShowCommitSearchCommandArgs]
arguments: [this, { searchBy: GitRepoSearchBy.Message } as SearchCommitsCommandArgs]
},
`Search commits by message (use <message-pattern>)`,
'Click to search commits by message'
@ -38,7 +38,7 @@ export class SearchNode extends ViewNode {
this,
{
...command,
arguments: [this, { searchBy: GitRepoSearchBy.Author } as ShowCommitSearchCommandArgs]
arguments: [this, { searchBy: GitRepoSearchBy.Author } as SearchCommitsCommandArgs]
},
`${GlyphChars.Space.repeat(4)} or, by author (use @<author-pattern>)`,
'Click to search commits by author'
@ -48,7 +48,7 @@ export class SearchNode extends ViewNode {
this,
{
...command,
arguments: [this, { searchBy: GitRepoSearchBy.Sha } as ShowCommitSearchCommandArgs]
arguments: [this, { searchBy: GitRepoSearchBy.Sha } as SearchCommitsCommandArgs]
},
`${GlyphChars.Space.repeat(4)} or, by commit id (use #<sha>)`,
'Click to search commits by commit id'
@ -58,7 +58,7 @@ export class SearchNode extends ViewNode {
this,
{
...command,
arguments: [this, { searchBy: GitRepoSearchBy.Files } as ShowCommitSearchCommandArgs]
arguments: [this, { searchBy: GitRepoSearchBy.Files } as SearchCommitsCommandArgs]
},
`${GlyphChars.Space.repeat(4)} or, by files (use :<file-pattern>)`,
'Click to search commits by files'
@ -68,7 +68,7 @@ export class SearchNode extends ViewNode {
this,
{
...command,
arguments: [this, { searchBy: GitRepoSearchBy.Changes } as ShowCommitSearchCommandArgs]
arguments: [this, { searchBy: GitRepoSearchBy.Changes } as SearchCommitsCommandArgs]
},
`${GlyphChars.Space.repeat(4)} or, by changes (use =<pattern>)`,
'Click to search commits by changes'
@ -78,7 +78,7 @@ export class SearchNode extends ViewNode {
this,
{
...command,
arguments: [this, { searchBy: GitRepoSearchBy.ChangedLines } as ShowCommitSearchCommandArgs]
arguments: [this, { searchBy: GitRepoSearchBy.ChangedLines } as SearchCommitsCommandArgs]
},
`${GlyphChars.Space.repeat(4)} or, by changed lines (use ~<pattern>)`,
'Click to search commits by changed lines'

Notiek ielāde…
Atcelt
Saglabāt