mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-12 02:58:32 -05:00
Reworks more commands deal with context
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
import { TextDocumentShowOptions, TextEditor, Uri, window } from 'vscode';
|
||||
import { ActiveEditorCommand, Commands, getCommandUri, openEditor } from './common';
|
||||
import { ActiveEditorCommand, CommandContext, Commands, getCommandUri, openEditor } from './common';
|
||||
import { GitService } from '../gitService';
|
||||
import { Logger } from '../logger';
|
||||
import { Messages } from '../messages';
|
||||
@@ -15,7 +15,23 @@ export class OpenChangedFilesCommand extends ActiveEditorCommand {
|
||||
super(Commands.OpenChangedFiles);
|
||||
}
|
||||
|
||||
async execute(editor: TextEditor, uri?: Uri, args: OpenChangedFilesCommandArgs = {}) {
|
||||
async run(context: CommandContext, args: OpenChangedFilesCommandArgs = {}): Promise<any> {
|
||||
// Since we can change the args and they could be cached -- make a copy
|
||||
switch (context.type) {
|
||||
case 'uri':
|
||||
return this.execute(context.editor, context.uri, { ...args });
|
||||
case 'scm-states':
|
||||
return undefined;
|
||||
case 'scm-groups':
|
||||
// const group = context.scmResourceGroups[0];
|
||||
// args.uris = group.resourceStates.map(_ => _.resourceUri);
|
||||
return this.execute(undefined, undefined, { ...args });
|
||||
default:
|
||||
return this.execute(context.editor, undefined, { ...args });
|
||||
}
|
||||
}
|
||||
|
||||
async execute(editor: TextEditor | undefined, uri?: Uri, args: OpenChangedFilesCommandArgs = {}) {
|
||||
uri = getCommandUri(uri, editor);
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user