Fixes another off-by-one issue when diffing with caching

Refactored commands and blame annotations
This commit is contained in:
Eric Amodio
2016-09-26 00:55:54 -04:00
parent 23b2c679a9
commit d2d72f0d54
16 changed files with 519 additions and 455 deletions

33
src/commands/commands.ts Normal file
View File

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