Skip to content

Commit

Permalink
Fixes line blame disappearing after closing large dirty editor
Browse files Browse the repository at this point in the history
Fixes #3066.
  • Loading branch information
gluxon authored and eamodio committed Jan 5, 2024
1 parent e82f7ea commit 6bc9793
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Fixes [#3087](https://github.com/gitkraken/vscode-gitlens/issues/3087) - Terminal executed commands fail if the GitLens terminal is closed
- Fixes [#2784](https://github.com/gitkraken/vscode-gitlens/issues/2784) - Git stash push error
- Fixes [#2926](https://github.com/gitkraken/vscode-gitlens/issues/2926) in more cases - "Open File at Revision" has incorrect editor label if revision contains path separator — thanks to [PR #3060](https://github.com/gitkraken/vscode-gitlens/issues/3060) by Ian Chamberlain ([@ian-h-chamberlain](https://github.com/ian-h-chamberlain)
- Fixes [#3066](https://github.com/gitkraken/vscode-gitlens/issues/3066) - Editing a large file and switching away to another file without saving causes current line blame to disappear; thanks to [PR #3067](https://github.com/gitkraken/vscode-gitlens/pulls/3067) by Brandon Cheng ([@gluxon](https://github.com/gluxon)).

## [14.6.1] - 2023-12-14

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ A big thanks to the people that have contributed to this project 🙏❤️:
- WofWca ([@WofWca](https://github.com/WofWca)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=WofWca)
- 不见月 ([@nooooooom](https://github.com/nooooooom)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=nooooooom)
- Ian Chamberlain ([@ian-h-chamberlain](https://github.com/ian-h-chamberlain)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=ian-h-chamberlain)
- Brandon Cheng ([@gluxon](https://github.com/gluxon)) — [contributions](https://github.com/gitkraken/vscode-gitlens/commits?author=gluxon)`

Also special thanks to the people that have provided support, testing, brainstorming, etc:

Expand Down
12 changes: 12 additions & 0 deletions src/trackers/gitLineTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ export class GitLineTracker extends LineTracker<GitLineState> {
this._subscriptionOnlyWhenActive = undefined;
}

protected override onActiveEditorChanged() {
// The GitLineTracker is suspended for performance while users have
// dirty changes in a large editor with lines exceeding the
// advanced.blame.sizeThresholdAfterEdit config.
//
// We'll need to resume if the active editor has changed (since the
// suspension was for the previous editor). Otherwise the line tracker
// would stay suspended after navigating away from the large dirty
// document.
this.resume();
}

@debug<GitLineTracker['onBlameStateChanged']>({
args: {
0: e => `editor/doc=${e.editor.document.uri.toString(true)}, blameable=${e.blameable}`,
Expand Down
7 changes: 7 additions & 0 deletions src/trackers/lineTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export class LineTracker<T> implements Disposable {
this._selections = toLineSelections(editor?.selections);

this.notifyLinesChanged('editor');
this.onActiveEditorChanged?.();
}

private onTextEditorSelectionChanged(e: TextEditorSelectionChangeEvent) {
Expand Down Expand Up @@ -197,6 +198,12 @@ export class LineTracker<T> implements Disposable {
this.notifyLinesChanged('editor');
}

/**
* Called after the active editor is changed and line tracker state has been
* updated for it.
*/
protected onActiveEditorChanged?(): void;

protected fireLinesChanged(e: LinesChangeEvent) {
this._onDidChangeActiveLines.fire(e);
}
Expand Down

0 comments on commit 6bc9793

Please sign in to comment.