mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-16 10:58:34 -05:00
1.0 wip
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user