Skip to content

Commit

Permalink
explorer: register decorations provider only once rendered
Browse files Browse the repository at this point in the history
fixes #90119
  • Loading branch information
isidorn committed Feb 7, 2020
1 parent 3e19c97 commit 91f5a4b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/vs/workbench/contrib/files/browser/views/explorerView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export class ExplorerView extends ViewPane {
private dragHandler!: DelayedDragHandler;
private autoReveal = false;
private actions: IAction[] | undefined;
private decorationsProvider: ExplorerDecorationsProvider | undefined;

constructor(
options: IViewPaneOptions,
Expand All @@ -159,7 +160,7 @@ export class ExplorerView extends ViewPane {
@IKeybindingService keybindingService: IKeybindingService,
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@IConfigurationService configurationService: IConfigurationService,
@IDecorationsService decorationService: IDecorationsService,
@IDecorationsService private readonly decorationService: IDecorationsService,
@ILabelService private readonly labelService: ILabelService,
@IThemeService private readonly themeService: IWorkbenchThemeService,
@IMenuService private readonly menuService: IMenuService,
Expand All @@ -183,10 +184,6 @@ export class ExplorerView extends ViewPane {
this.compressedFocusLastContext = ExplorerCompressedLastFocusContext.bindTo(contextKeyService);

this.explorerService.registerContextProvider(this);

const decorationProvider = new ExplorerDecorationsProvider(this.explorerService, contextService);
this._register(decorationService.registerDecorationsProvider(decorationProvider));
this._register(decorationProvider);
}

get name(): string {
Expand Down Expand Up @@ -582,7 +579,7 @@ export class ExplorerView extends ViewPane {
return DOM.getLargestChildWidth(parentNode, childNodes);
}

private setTreeInput(): Promise<void> {
private async setTreeInput(): Promise<void> {
if (!this.isBodyVisible()) {
this.shouldRefresh = true;
return Promise.resolve(undefined);
Expand Down Expand Up @@ -631,7 +628,11 @@ export class ExplorerView extends ViewPane {
delay: this.layoutService.isRestored() ? 800 : 1200 // less ugly initial startup
}, _progress => promise);

return promise;
await promise;
if (!this.decorationsProvider) {
this.decorationsProvider = new ExplorerDecorationsProvider(this.explorerService, this.contextService);
this._register(this.decorationService.registerDecorationsProvider(this.decorationsProvider));
}
}

private getActiveFile(): URI | undefined {
Expand Down

0 comments on commit 91f5a4b

Please sign in to comment.