Skip to content

Commit e66046b

Browse files
committed
Restores additional decorations
1 parent 52e9441 commit e66046b

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [Unreleased]
8+
### Fixed
9+
- Fixes issue where [Gravatars](https://en.gravatar.com/) in the gutter blame annotations weren't restored on tab switch
10+
711
## [7.5.3] - 2018-01-15
812
### Fixed
913
- Fixes [#245](https://github.com/eamodio/vscode-gitlens/issues/245) - CodeLens disappears/and reappears when auto-saving

src/annotations/annotationProvider.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22
import { Functions } from '../system';
3-
import { DecorationOptions, Disposable, TextDocument, TextEditor, TextEditorDecorationType, TextEditorSelectionChangeEvent, Uri, window } from 'vscode';
3+
import { DecorationOptions, Disposable, Range, TextDocument, TextEditor, TextEditorDecorationType, TextEditorSelectionChangeEvent, Uri, window } from 'vscode';
44
import { FileAnnotationType } from '../configuration';
55
import { TextDocumentComparer } from '../comparers';
66
import { GitDocumentState, TrackedDocument } from '../trackers/documentTracker';
@@ -58,10 +58,10 @@ export abstract class AnnotationProviderBase extends Disposable {
5858
return this.editor.document.uri;
5959
}
6060

61-
protected decorationTypes: TextEditorDecorationType[] | undefined;
61+
protected additionalDecorations: { decoration: TextEditorDecorationType, ranges: Range[] }[] | undefined;
6262

6363
async clear() {
64-
if (this.editor === undefined || this.decorationTypes === undefined || this.decorationTypes.length === 0) return;
64+
if (this.editor === undefined || this.additionalDecorations === undefined || this.additionalDecorations.length === 0) return;
6565

6666
if (this.decoration !== undefined) {
6767
try {
@@ -70,15 +70,15 @@ export abstract class AnnotationProviderBase extends Disposable {
7070
catch { }
7171
}
7272

73-
if (this.decorationTypes !== undefined && this.decorationTypes.length > 0) {
74-
for (const dt of this.decorationTypes) {
73+
if (this.additionalDecorations !== undefined && this.additionalDecorations.length > 0) {
74+
for (const d of this.additionalDecorations) {
7575
try {
76-
this.editor.setDecorations(dt, []);
76+
this.editor.setDecorations(d.decoration, []);
7777
}
7878
catch { }
7979
}
8080

81-
this.decorationTypes = undefined;
81+
this.additionalDecorations = undefined;
8282
}
8383

8484
if (this.highlightDecoration !== undefined) {
@@ -121,6 +121,12 @@ export abstract class AnnotationProviderBase extends Disposable {
121121

122122
if (this.decorations !== undefined && this.decorations.length) {
123123
this.editor.setDecorations(this.decoration!, this.decorations);
124+
125+
if (this.additionalDecorations !== undefined && this.additionalDecorations.length) {
126+
for (const d of this.additionalDecorations) {
127+
this.editor.setDecorations(d.decoration, d.ranges);
128+
}
129+
}
124130
}
125131
}
126132

src/annotations/gutterBlameAnnotationProvider.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ export class GutterBlameAnnotationProvider extends BlameAnnotationProviderBase {
121121
this.editor.setDecorations(this.decoration!, this.decorations);
122122

123123
if (gravatars) {
124-
this.decorationTypes = [];
125-
for (const a of Objects.values(avatarDecorationsMap!)) {
126-
this.decorationTypes.push(a.decoration);
127-
this.editor.setDecorations(a.decoration, a.ranges);
124+
this.additionalDecorations = [];
125+
for (const d of Objects.values(avatarDecorationsMap!)) {
126+
this.additionalDecorations.push(d);
127+
this.editor.setDecorations(d.decoration, d.ranges);
128128
}
129129
}
130130
}

0 commit comments

Comments
 (0)