Browse Source

Restores additional decorations

main
Eric Amodio 6 years ago
parent
commit
e66046ba3c
3 changed files with 21 additions and 11 deletions
  1. +4
    -0
      CHANGELOG.md
  2. +13
    -7
      src/annotations/annotationProvider.ts
  3. +4
    -4
      src/annotations/gutterBlameAnnotationProvider.ts

+ 4
- 0
CHANGELOG.md View File

@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Fixed
- Fixes issue where [Gravatars](https://en.gravatar.com/) in the gutter blame annotations weren't restored on tab switch
## [7.5.3] - 2018-01-15
### Fixed
- Fixes [#245](https://github.com/eamodio/vscode-gitlens/issues/245) - CodeLens disappears/and reappears when auto-saving

+ 13
- 7
src/annotations/annotationProvider.ts View File

@ -1,6 +1,6 @@
'use strict';
import { Functions } from '../system';
import { DecorationOptions, Disposable, TextDocument, TextEditor, TextEditorDecorationType, TextEditorSelectionChangeEvent, Uri, window } from 'vscode';
import { DecorationOptions, Disposable, Range, TextDocument, TextEditor, TextEditorDecorationType, TextEditorSelectionChangeEvent, Uri, window } from 'vscode';
import { FileAnnotationType } from '../configuration';
import { TextDocumentComparer } from '../comparers';
import { GitDocumentState, TrackedDocument } from '../trackers/documentTracker';
@ -58,10 +58,10 @@ export abstract class AnnotationProviderBase extends Disposable {
return this.editor.document.uri;
}
protected decorationTypes: TextEditorDecorationType[] | undefined;
protected additionalDecorations: { decoration: TextEditorDecorationType, ranges: Range[] }[] | undefined;
async clear() {
if (this.editor === undefined || this.decorationTypes === undefined || this.decorationTypes.length === 0) return;
if (this.editor === undefined || this.additionalDecorations === undefined || this.additionalDecorations.length === 0) return;
if (this.decoration !== undefined) {
try {
@ -70,15 +70,15 @@ export abstract class AnnotationProviderBase extends Disposable {
catch { }
}
if (this.decorationTypes !== undefined && this.decorationTypes.length > 0) {
for (const dt of this.decorationTypes) {
if (this.additionalDecorations !== undefined && this.additionalDecorations.length > 0) {
for (const d of this.additionalDecorations) {
try {
this.editor.setDecorations(dt, []);
this.editor.setDecorations(d.decoration, []);
}
catch { }
}
this.decorationTypes = undefined;
this.additionalDecorations = undefined;
}
if (this.highlightDecoration !== undefined) {
@ -121,6 +121,12 @@ export abstract class AnnotationProviderBase extends Disposable {
if (this.decorations !== undefined && this.decorations.length) {
this.editor.setDecorations(this.decoration!, this.decorations);
if (this.additionalDecorations !== undefined && this.additionalDecorations.length) {
for (const d of this.additionalDecorations) {
this.editor.setDecorations(d.decoration, d.ranges);
}
}
}
}

+ 4
- 4
src/annotations/gutterBlameAnnotationProvider.ts View File

@ -121,10 +121,10 @@ export class GutterBlameAnnotationProvider extends BlameAnnotationProviderBase {
this.editor.setDecorations(this.decoration!, this.decorations);
if (gravatars) {
this.decorationTypes = [];
for (const a of Objects.values(avatarDecorationsMap!)) {
this.decorationTypes.push(a.decoration);
this.editor.setDecorations(a.decoration, a.ranges);
this.additionalDecorations = [];
for (const d of Objects.values(avatarDecorationsMap!)) {
this.additionalDecorations.push(d);
this.editor.setDecorations(d.decoration, d.ranges);
}
}
}

Loading…
Cancel
Save