提交 e9fd404d 编写于 作者: D Daniel Imms

Fix terminal panel hiding when last instance is closed

Fixes #94577
上级 fe86e99a
......@@ -6,7 +6,6 @@
import * as nls from 'vs/nls';
import { TERMINAL_VIEW_ID, IShellLaunchConfig, ITerminalConfigHelper, ITerminalNativeService, ISpawnExtHostProcessRequest, IStartExtensionTerminalRequest, IAvailableShellsRequest, KEYBINDING_CONTEXT_TERMINAL_FOCUS, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE, KEYBINDING_CONTEXT_TERMINAL_IS_OPEN, ITerminalProcessExtHostProxy, IShellDefinition, LinuxDistro, KEYBINDING_CONTEXT_TERMINAL_SHELL_TYPE } from 'vs/workbench/contrib/terminal/common/terminal';
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
import { TerminalViewPane } from 'vs/workbench/contrib/terminal/browser/terminalView';
......@@ -31,8 +30,9 @@ import { basename } from 'vs/base/common/path';
import { INativeOpenFileRequest } from 'vs/platform/windows/node/window';
import { find } from 'vs/base/common/arrays';
import { timeout } from 'vs/base/common/async';
import { IViewsService } from 'vs/workbench/common/views';
import { IViewsService, ViewContainerLocation, IViewDescriptorService } from 'vs/workbench/common/views';
import { IDisposable } from 'vs/base/common/lifecycle';
import { Orientation } from 'vs/base/browser/ui/sash/sash';
interface IExtHostReadyEntry {
promise: Promise<void>;
......@@ -96,7 +96,6 @@ export class TerminalService implements ITerminalService {
constructor(
@IContextKeyService private _contextKeyService: IContextKeyService,
@IPanelService private _panelService: IPanelService,
@IWorkbenchLayoutService private _layoutService: IWorkbenchLayoutService,
@ILifecycleService lifecycleService: ILifecycleService,
@IDialogService private _dialogService: IDialogService,
......@@ -106,6 +105,7 @@ export class TerminalService implements ITerminalService {
@IQuickInputService private _quickInputService: IQuickInputService,
@IConfigurationService private _configurationService: IConfigurationService,
@IViewsService private _viewsService: IViewsService,
@IViewDescriptorService private readonly _viewDescriptorService: IViewDescriptorService,
@optional(ITerminalNativeService) terminalNativeService: ITerminalNativeService
) {
// @optional could give undefined and properly typing it breaks service registration
......@@ -694,9 +694,16 @@ export class TerminalService implements ITerminalService {
}
public hidePanel(): void {
const panel = this._panelService.getActivePanel();
if (panel && panel.getId() === TERMINAL_VIEW_ID) {
this._layoutService.setPanelHidden(true);
// Hide the panel if the terminal is in the panel and it has no sibling views
const pane = this._viewsService.getActiveViewWithId(TERMINAL_VIEW_ID) as TerminalViewPane;
if (pane && pane.orientation === Orientation.HORIZONTAL) {
const location = this._viewDescriptorService.getViewLocation(TERMINAL_VIEW_ID);
if (location === ViewContainerLocation.Panel) {
const panel = this._viewDescriptorService.getViewContainer(TERMINAL_VIEW_ID);
if (panel && this._viewDescriptorService.getViewDescriptors(panel).activeViewDescriptors.length === 1) {
this._layoutService.setPanelHidden(true);
}
}
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册