mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-19 01:35:37 -05:00
Adds new GitLens custom view
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
import { Iterables } from '../system';
|
||||
import { TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands, getCommandUri } from './common';
|
||||
import { ActiveEditorCommand, CommandContext, Commands, getCommandUri, isCommandViewContextWithCommit } from './common';
|
||||
import { GitService, GitUri } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { copy } from 'copy-paste';
|
||||
@@ -17,6 +17,16 @@ export class CopyMessageToClipboardCommand extends ActiveEditorCommand {
|
||||
super(Commands.CopyMessageToClipboard);
|
||||
}
|
||||
|
||||
protected async preExecute(context: CommandContext, args: CopyMessageToClipboardCommandArgs = {}): Promise<any> {
|
||||
if (isCommandViewContextWithCommit(context)) {
|
||||
args = { ...args };
|
||||
args.sha = context.node.commit.sha;
|
||||
return this.execute(context.editor, context.node.commit.uri, args);
|
||||
}
|
||||
|
||||
return this.execute(context.editor, context.uri, args);
|
||||
}
|
||||
|
||||
async execute(editor?: TextEditor, uri?: Uri, args: CopyMessageToClipboardCommandArgs = {}): Promise<any> {
|
||||
uri = getCommandUri(uri, editor);
|
||||
|
||||
@@ -64,7 +74,7 @@ export class CopyMessageToClipboardCommand extends ActiveEditorCommand {
|
||||
|
||||
// Get the full commit message -- since blame only returns the summary
|
||||
const commit = await this.git.getLogCommit(gitUri.repoPath, gitUri.fsPath, args.sha);
|
||||
if (!commit) return undefined;
|
||||
if (commit === undefined) return undefined;
|
||||
|
||||
args.message = commit.message;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user