Fixes issue with undo not causing annotations to reappear

Might address #42
This commit is contained in:
Eric Amodio
2017-03-03 12:47:13 -05:00
parent 4da21c3cc1
commit aeab246e0a
2 changed files with 9 additions and 8 deletions

View File

@@ -157,10 +157,6 @@ export class BlameActiveLineController extends Disposable {
// Make sure this is for the editor we are tracking
if (!TextEditorComparer.equals(this._editor, e.editor)) return;
const line = this._editor.selection.active.line;
if (line === this._currentLine) return;
this._currentLine = line;
this._updateBlame(this._editor.selection.active.line, this._editor);
}

View File

@@ -62,15 +62,20 @@ export class BlameabilityTracker extends Disposable {
private _onTextDocumentChanged(e: TextDocumentChangeEvent) {
if (!TextDocumentComparer.equals(this._editor && this._editor.document, e && e.document)) return;
this._unsubscribeToDocumentChanges();
this.updateBlameability(false);
// Can't unsubscribe here because undo doesn't trigger any other event
//this._unsubscribeToDocumentChanges();
//this.updateBlameability(false);
// We have to defer because isDirty is not reliable inside this event
setTimeout(() => this.updateBlameability(!e.document.isDirty), 1);
}
private _onTextDocumentSaved(e: TextDocument) {
if (!TextDocumentComparer.equals(this._editor && this._editor.document, e)) return;
this._subscribeToDocumentChanges();
this.updateBlameability(true);
// Don't need to resubscribe as we aren't unsubscribing on document changes anymore
//this._subscribeToDocumentChanges();
this.updateBlameability(!e.isDirty);
}
private _subscribeToDocumentChanges() {