mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-15 01:25:42 -05:00
Reworks commanding structure for less redundancy
Adds command args copying when needed
This commit is contained in:
@@ -21,12 +21,16 @@ export class DiffLineWithPreviousCommand extends ActiveEditorCommand {
|
||||
super(Commands.DiffLineWithPrevious);
|
||||
}
|
||||
|
||||
async execute(editor: TextEditor, uri?: Uri, args: DiffLineWithPreviousCommandArgs = {}): Promise<any> {
|
||||
async execute(editor?: TextEditor, uri?: Uri, args: DiffLineWithPreviousCommandArgs = {}): Promise<any> {
|
||||
uri = getCommandUri(uri, editor);
|
||||
if (uri === undefined) return undefined;
|
||||
|
||||
const gitUri = await GitUri.fromUri(uri, this.git);
|
||||
args.line = args.line || (editor === undefined ? gitUri.offset : editor.selection.active.line);
|
||||
|
||||
args = { ...args };
|
||||
if (args.line === undefined) {
|
||||
args.line = editor === undefined ? gitUri.offset : editor.selection.active.line;
|
||||
}
|
||||
|
||||
if (args.commit === undefined || GitService.isUncommitted(args.commit.sha)) {
|
||||
if (editor !== undefined && editor.document !== undefined && editor.document.isDirty) return undefined;
|
||||
|
||||
Reference in New Issue
Block a user