Skip to content

Commit

Permalink
Emit old and new URI's to ensure ProvideWrapper.data correctly updated (
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-grant-work authored Apr 22, 2022
1 parent 43f8e41 commit 06b848e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/git/src/browser/git-decoration-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ export class GitDecorationProvider implements DecorationsProvider {
const newDecorations = new Map<string, Decoration>();
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<string, Decoration>): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,20 @@ 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<URI[]>();
get onDidChange(): Event<URI[]> {
return this.onDidChangeEmitter.event;
}

@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<Decoration | undefined> | undefined {
Expand Down

0 comments on commit 06b848e

Please sign in to comment.