This commit is contained in:
Eric Amodio
2016-11-03 03:09:33 -04:00
parent 8df6b80725
commit 409be335f9
38 changed files with 1094 additions and 520 deletions

View File

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