mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-16 18:48:45 -05:00
Fixes overzealous updating on document changes
This commit is contained in:
@@ -23,6 +23,7 @@ export default class BlameActiveLineController extends Disposable {
|
|||||||
private _currentLine: number = -1;
|
private _currentLine: number = -1;
|
||||||
private _disposable: Disposable;
|
private _disposable: Disposable;
|
||||||
private _editor: TextEditor | undefined;
|
private _editor: TextEditor | undefined;
|
||||||
|
private _editorIsDirty: boolean;
|
||||||
private _statusBarItem: StatusBarItem | undefined;
|
private _statusBarItem: StatusBarItem | undefined;
|
||||||
private _updateBlameDebounced: (line: number, editor: TextEditor) => Promise<void>;
|
private _updateBlameDebounced: (line: number, editor: TextEditor) => Promise<void>;
|
||||||
private _uri: GitUri;
|
private _uri: GitUri;
|
||||||
@@ -153,7 +154,11 @@ export default class BlameActiveLineController extends Disposable {
|
|||||||
private _onDocumentChanged(e: TextDocumentChangeEvent) {
|
private _onDocumentChanged(e: TextDocumentChangeEvent) {
|
||||||
// Make sure this is for the editor we are tracking
|
// Make sure this is for the editor we are tracking
|
||||||
if (!this._editor || !TextDocumentComparer.equals(e.document, this._editor.document)) return;
|
if (!this._editor || !TextDocumentComparer.equals(e.document, this._editor.document)) return;
|
||||||
this._currentLine = -1;
|
|
||||||
|
const line = this._editor.selections[0].active.line;
|
||||||
|
if (line === this._currentLine && this._editorIsDirty === this._editor.document.isDirty) return;
|
||||||
|
this._currentLine = line;
|
||||||
|
this._editorIsDirty = this._editor.document.isDirty;
|
||||||
|
|
||||||
this._updateBlame(this._editor.selections[0].active.line, this._editor);
|
this._updateBlame(this._editor.selections[0].active.line, this._editor);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user