From 06b848e7d4f60ce4209fc17079fc40cab24312b5 Mon Sep 17 00:00:00 2001 From: colin-grant-work Date: Fri, 22 Apr 2022 15:42:32 -0600 Subject: [PATCH] Emit old and new URI's to ensure ProvideWrapper.data correctly updated (#11066) --- packages/git/src/browser/git-decoration-provider.ts | 3 ++- .../src/browser/problem/problem-decorations-provider.ts | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/git/src/browser/git-decoration-provider.ts b/packages/git/src/browser/git-decoration-provider.ts index ca5cb2bf9106f..c4ab65596cc99 100644 --- a/packages/git/src/browser/git-decoration-provider.ts +++ b/packages/git/src/browser/git-decoration-provider.ts @@ -43,8 +43,9 @@ export class GitDecorationProvider implements DecorationsProvider { const newDecorations = new Map(); this.collectDecorationData(event.status.changes, newDecorations); + const uris = new Set([...this.decorations.keys()].concat([...newDecorations.keys()])); this.decorations = newDecorations; - this.onDidChangeDecorationsEmitter.fire(Array.from(newDecorations.keys(), value => new URI(value))); + this.onDidChangeDecorationsEmitter.fire(Array.from(uris, value => new URI(value))); } private collectDecorationData(changes: GitFileChange[], bucket: Map): void { diff --git a/packages/markers/src/browser/problem/problem-decorations-provider.ts b/packages/markers/src/browser/problem/problem-decorations-provider.ts index bdb3fd4479382..0ed8804f8a6ea 100644 --- a/packages/markers/src/browser/problem/problem-decorations-provider.ts +++ b/packages/markers/src/browser/problem/problem-decorations-provider.ts @@ -26,6 +26,8 @@ import { CancellationToken, Emitter, Event, nls } from '@theia/core'; export class ProblemDecorationsProvider implements DecorationsProvider { @inject(ProblemManager) protected readonly problemManager: ProblemManager; + protected currentUris: URI[] = []; + protected readonly onDidChangeEmitter = new Emitter(); get onDidChange(): Event { return this.onDidChangeEmitter.event; @@ -33,7 +35,11 @@ export class ProblemDecorationsProvider implements DecorationsProvider { @postConstruct() protected init(): void { - this.problemManager.onDidChangeMarkers(() => this.onDidChangeEmitter.fire(Array.from(this.problemManager.getUris(), stringified => new URI(stringified)))); + this.problemManager.onDidChangeMarkers(() => { + const newUris = Array.from(this.problemManager.getUris(), stringified => new URI(stringified)); + this.onDidChangeEmitter.fire(newUris.concat(this.currentUris)); + this.currentUris = newUris; + }); } provideDecorations(uri: URI, token: CancellationToken): Decoration | Promise | undefined {