Moves Commands into commands file

This commit is contained in:
Eric Amodio
2017-02-25 02:19:40 -05:00
parent 237e464c44
commit a2f4c4c953
20 changed files with 95 additions and 102 deletions

View File

@@ -1,53 +0,0 @@
'use strict';
import { commands, Disposable, TextEditor, TextEditorEdit, window } from 'vscode';
import { Commands } from '../constants';
export abstract class Command extends Disposable {
private _disposable: Disposable;
constructor(command: Commands) {
super(() => this.dispose());
this._disposable = commands.registerCommand(command, this.execute, this);
}
dispose() {
this._disposable && this._disposable.dispose();
}
abstract execute(...args: any[]): any;
}
export abstract class EditorCommand extends Disposable {
private _disposable: Disposable;
constructor(command: Commands) {
super(() => this.dispose());
this._disposable = commands.registerTextEditorCommand(command, this.execute, this);
}
dispose() {
this._disposable && this._disposable.dispose();
}
abstract execute(editor: TextEditor, edit: TextEditorEdit, ...args: any[]): any;
}
export abstract class ActiveEditorCommand extends Disposable {
private _disposable: Disposable;
constructor(command: Commands) {
super(() => this.dispose());
this._disposable = commands.registerCommand(command, this._execute, this);
}
dispose() {
this._disposable && this._disposable.dispose();
}
_execute(...args: any[]): any {
return this.execute(window.activeTextEditor, ...args);
}
abstract execute(editor: TextEditor, ...args: any[]): any;
}

View File

@@ -1,8 +1,7 @@
'use strict';
import { Iterables } from '../system';
import { TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand } from './commands';
import { Commands } from '../constants';
import { ActiveEditorCommand, Commands } from '../commands';
import GitProvider, { GitUri } from '../gitProvider';
import { Logger } from '../logger';
import { copy } from 'copy-paste';

View File

@@ -1,8 +1,7 @@
'use strict';
import { Iterables } from '../system';
import { TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand } from './commands';
import { Commands } from '../constants';
import { ActiveEditorCommand, Commands } from '../commands';
import GitProvider, { GitUri } from '../gitProvider';
import { Logger } from '../logger';
import { copy } from 'copy-paste';

View File

@@ -1,7 +1,7 @@
'use strict';
import { commands, TextEditor, TextEditorEdit, Uri, window } from 'vscode';
import { EditorCommand } from './commands';
import { BuiltInCommands, Commands } from '../constants';
import { Commands, EditorCommand } from '../commands';
import { BuiltInCommands } from '../constants';
import GitProvider, { GitCommit, GitUri } from '../gitProvider';
import { Logger } from '../logger';
import * as path from 'path';

View File

@@ -1,7 +1,6 @@
'use strict';
import { commands, TextEditor, TextEditorEdit, Uri, window } from 'vscode';
import { EditorCommand } from './commands';
import { Commands } from '../constants';
import { Commands, EditorCommand } from '../commands';
import GitProvider, { GitCommit, GitUri } from '../gitProvider';
import { Logger } from '../logger';

View File

@@ -1,8 +1,8 @@
'use strict';
import { Iterables } from '../system';
import { commands, Range, TextEditor, TextEditorEdit, Uri, window } from 'vscode';
import { EditorCommand } from './commands';
import { BuiltInCommands, Commands } from '../constants';
import { Commands, EditorCommand } from '../commands';
import { BuiltInCommands } from '../constants';
import GitProvider, { GitCommit, GitUri } from '../gitProvider';
import { Logger } from '../logger';
import * as moment from 'moment';

View File

@@ -1,8 +1,8 @@
'use strict';
import { Iterables } from '../system';
import { commands, TextEditor, TextEditorEdit, Uri, window } from 'vscode';
import { EditorCommand } from './commands';
import { BuiltInCommands, Commands } from '../constants';
import { Commands, EditorCommand } from '../commands';
import { BuiltInCommands } from '../constants';
import GitProvider, { GitCommit, GitUri } from '../gitProvider';
import { Logger } from '../logger';
import * as path from 'path';

View File

@@ -1,8 +1,7 @@
'use strict';
import { TextEditor, TextEditorEdit, Uri, window } from 'vscode';
import BlameAnnotationController from '../blameAnnotationController';
import { EditorCommand } from './commands';
import { Commands } from '../constants';
import { Commands, EditorCommand } from '../commands';
import { Logger } from '../logger';
export default class ShowBlameCommand extends EditorCommand {

View File

@@ -1,7 +1,7 @@
'use strict';
import { commands, Position, Range, TextEditor, TextEditorEdit, Uri, window } from 'vscode';
import { EditorCommand } from './commands';
import { BuiltInCommands, Commands } from '../constants';
import { Commands, EditorCommand } from '../commands';
import { BuiltInCommands } from '../constants';
import GitProvider, { GitUri } from '../gitProvider';
import { Logger } from '../logger';

View File

@@ -1,7 +1,7 @@
'use strict';
import { commands, Position, Range, TextEditor, TextEditorEdit, Uri, window } from 'vscode';
import { EditorCommand } from './commands';
import { BuiltInCommands, Commands } from '../constants';
import { Commands, EditorCommand } from '../commands';
import { BuiltInCommands } from '../constants';
import GitProvider, { GitUri } from '../gitProvider';
import { Logger } from '../logger';

View File

@@ -1,8 +1,7 @@
'use strict';
import { Iterables } from '../system';
import { commands, TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand } from './commands';
import { Commands } from '../constants';
import { ActiveEditorCommand, Commands } from '../commands';
import GitProvider, { GitCommit, GitUri } from '../gitProvider';
import { Logger } from '../logger';
import { CommandQuickPickItem, FileQuickPickItem } from './quickPickItems';

View File

@@ -1,7 +1,6 @@
'use strict';
import { commands, TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand } from './commands';
import { Commands } from '../constants';
import { ActiveEditorCommand, Commands } from '../commands';
import GitProvider, { GitCommit, GitUri } from '../gitProvider';
import { Logger } from '../logger';
import { CommandQuickPickItem } from './quickPickItems';

View File

@@ -1,7 +1,6 @@
'use strict';
import { commands, TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand } from './commands';
import { Commands } from '../constants';
import { ActiveEditorCommand, Commands } from '../commands';
import GitProvider, { GitCommit, GitUri } from '../gitProvider';
import { Logger } from '../logger';
import { CommandQuickPickItem } from './quickPickItems';

View File

@@ -1,8 +1,7 @@
'use strict';
import { TextEditor, TextEditorEdit, Uri, window } from 'vscode';
import BlameAnnotationController from '../blameAnnotationController';
import { EditorCommand } from './commands';
import { Commands } from '../constants';
import { Commands, EditorCommand } from '../commands';
import { Logger } from '../logger';
export default class ToggleBlameCommand extends EditorCommand {

View File

@@ -1,7 +1,6 @@
'use strict';
import { TextEditor, TextEditorEdit } from 'vscode';
import { EditorCommand } from './commands';
import { Commands } from '../constants';
import { Commands, EditorCommand } from '../commands';
import GitProvider from '../gitProvider';
export default class ToggleCodeLensCommand extends EditorCommand {