Views render welcome when window reloads/quits (fix #208878) (#208910)

This commit is contained in:
Benjamin Pasero 2024-03-28 07:39:26 +01:00 committed by GitHub
parent 8e386a6a96
commit f0b4597c2c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -49,6 +49,7 @@ import { ServiceCollection } from 'vs/platform/instantiation/common/serviceColle
import { defaultButtonStyles, defaultProgressBarStyles } from 'vs/platform/theme/browser/defaultStyles';
import { ICustomHover, setupCustomHover } from 'vs/base/browser/ui/hover/updatableHoverWidget';
import { getDefaultHoverDelegate } from 'vs/base/browser/ui/hover/hoverDelegateFactory';
import { ILifecycleService } from 'vs/workbench/services/lifecycle/common/lifecycle';
export enum ViewPaneShowActions {
/** Show the actions when the view is hovered. This is the default behavior. */
@ -120,9 +121,10 @@ class ViewWelcomeController {
@IOpenerService protected openerService: IOpenerService,
@ITelemetryService protected telemetryService: ITelemetryService,
@IContextKeyService private contextKeyService: IContextKeyService,
@ILifecycleService lifecycleService: ILifecycleService
) {
this.delegate.onDidChangeViewWelcomeState(this.onDidChangeViewWelcomeState, this, this.disposables);
this.onDidChangeViewWelcomeState();
this.disposables.add(Event.runAndSubscribe(this.delegate.onDidChangeViewWelcomeState, () => this.onDidChangeViewWelcomeState()));
this.disposables.add(lifecycleService.onWillShutdown(() => this.dispose())); // Fixes https://github.com/microsoft/vscode/issues/208878
}
layout(height: number, width: number) {
@ -591,7 +593,7 @@ export abstract class ViewPane extends Pane implements IView {
}
protected renderBody(container: HTMLElement): void {
this.viewWelcomeController = this._register(new ViewWelcomeController(container, this, this.instantiationService, this.openerService, this.telemetryService, this.contextKeyService));
this.viewWelcomeController = this._register(this.instantiationService.createInstance(ViewWelcomeController, container, this));
}
protected layoutBody(height: number, width: number): void {