mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-16 18:48:45 -05:00
Prepopulates commit search to the current line commit
If there is an active editor, otherwise will fall back to the clipboard
This commit is contained in:
@@ -36,10 +36,25 @@ export class ShowCommitSearchCommand extends ActiveEditorCachedCommand {
|
|||||||
if (!repoPath) return window.showWarningMessage(`Unable to show commit search`);
|
if (!repoPath) return window.showWarningMessage(`Unable to show commit search`);
|
||||||
|
|
||||||
if (!args.search || args.searchBy == null) {
|
if (!args.search || args.searchBy == null) {
|
||||||
if (!args.search) {
|
try {
|
||||||
args.search = await new Promise<string>((resolve, reject) => {
|
if (!args.search) {
|
||||||
paste((err: Error, content: string) => resolve(err ? '' : content));
|
if (editor !== undefined && gitUri !== undefined) {
|
||||||
});
|
const line = editor.selection.active.line - gitUri.offset;
|
||||||
|
const blameLine = await this.git.getBlameForLine(gitUri, line);
|
||||||
|
if (blameLine !== undefined) {
|
||||||
|
args.search = `#${blameLine.commit.shortSha}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!args.search) {
|
||||||
|
args.search = await new Promise<string>((resolve, reject) => {
|
||||||
|
paste((err: Error, content: string) => resolve(err ? '' : content));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
Logger.error(ex, 'ShowCommitSearchCommand', 'search prefetch failed');
|
||||||
}
|
}
|
||||||
|
|
||||||
args.search = await window.showInputBox({
|
args.search = await window.showInputBox({
|
||||||
|
|||||||
Reference in New Issue
Block a user