Git - only show blame editor decoration in the active editor (#234655)

This commit is contained in:
Ladislau Szomoru
2024-11-26 12:54:47 +01:00
committed by GitHub
parent ef8d445243
commit 1aa83151f1
+12 -1
View File
@@ -272,7 +272,7 @@ export class GitBlameController {
@throttle
private async _updateTextEditorBlameInformation(textEditor: TextEditor | undefined): Promise<void> {
if (!textEditor?.diffInformation) {
if (!textEditor?.diffInformation || textEditor !== window.activeTextEditor) {
return;
}
@@ -398,12 +398,23 @@ class GitBlameEditorDecoration {
return;
}
// Clear decorations for the other editors
for (const editor of window.visibleTextEditors) {
if (editor === textEditor) {
continue;
}
editor.setDecorations(this._decorationType, []);
}
// Get blame information
const blameInformation = this._controller.textEditorBlameInformation.get(textEditor);
if (!blameInformation || textEditor.document.uri.scheme !== 'file') {
textEditor.setDecorations(this._decorationType, []);
return;
}
// Set decorations for the editor
const decorations = blameInformation.map(blame => {
const contentText = typeof blame.blameInformation === 'string'
? blame.blameInformation