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