src/vs/workbench/browser/layout.ts/Layout/setPanelHidden
class Layout:	setPanelHidden(hidden: boolean, skipLayout?: boolean): void {
		const wasHidden = this.state.panel.hidden;
		this.state.panel.hidden = hidden;

		// Return if not initialized fully #105480
		if (!this.workbenchGrid) {
			return;
		}

		const isPanelMaximized = this.isPanelMaximized();
		const panelOpensMaximized = this.panelOpensMaximized();

		// Adjust CSS
		if (hidden) {
			this.container.classList.add(Classes.PANEL_HIDDEN);
		} else {
			this.container.classList.remove(Classes.PANEL_HIDDEN);
		}

		// If panel part becomes hidden, also hide the current active panel if any
		let focusEditor = false;
		if (hidden && this.panelService.getActivePanel()) {
			this.panelService.hideActivePanel();
			focusEditor = true;
		}

		// If panel part becomes visible, show last active panel or default panel
		else if (!hidden && !this.panelService.getActivePanel()) {
			let panelToOpen: string | undefined = this.panelService.getLastActivePanelId();
			const hasViews = (id: string): boolean => {
				const viewContainer = this.viewDescriptorService.getViewContainerById(id);
				if (!viewContainer) {
					return false;
				}

				const viewContainerModel = this.viewDescriptorService.getViewContainerModel(viewContainer);
				if (!viewContainerModel) {
					return false;
				}

				return viewContainerModel.activeViewDescriptors.length >= 1;
			};

			// verify that the panel we try to open has views before we default to it
			// otherwise fall back to any view that has views still refs #111463
			if (!panelToOpen || !hasViews(panelToOpen)) {
				panelToOpen = this.viewDescriptorService
					.getViewContainersByLocation(ViewContainerLocation.Panel)
					.find(viewContainer => hasViews(viewContainer.id))?.id;
			}

			if (panelToOpen) {
				const focus = !skipLayout;
				this.panelService.openPanel(panelToOpen, focus);
			}
		}

		// If maximized and in process of hiding, unmaximize before hiding to allow caching of non-maximized size
		if (hidden && isPanelMaximized) {
			this.toggleMaximizedPanel();
		}

		// Don't proceed if we have already done this before
		if (wasHidden === hidden) {
			return;
		}

		// Propagate layout changes to grid
		this.workbenchGrid.setViewVisible(this.panelPartView, !hidden);
		// If in process of showing, toggle whether or not panel is maximized
		if (!hidden) {
			if (isPanelMaximized !== panelOpensMaximized) {
				this.toggleMaximizedPanel();
			}
		}
		else {
			// If in process of hiding, remember whether the panel is maximized or not
			this.state.panel.wasLastMaximized = isPanelMaximized;
		}
		// Remember in settings
		if (!hidden) {
			this.storageService.store(Storage.PANEL_HIDDEN, 'false', StorageScope.WORKSPACE, StorageTarget.USER);
		}
		else {
			this.storageService.remove(Storage.PANEL_HIDDEN, StorageScope.WORKSPACE);

			// Remember this setting only when panel is hiding
			if (this.state.panel.wasLastMaximized) {
				this.storageService.store(Storage.PANEL_LAST_IS_MAXIMIZED, true, StorageScope.WORKSPACE, StorageTarget.USER);
			}
			else {
				this.storageService.remove(Storage.PANEL_LAST_IS_MAXIMIZED, StorageScope.WORKSPACE);
			}
		}

		if (focusEditor) {
			this.editorGroupService.activeGroup.focus(); // Pass focus to editor group if panel part is now hidden
		}
	}