mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-27 10:37:38 +01:00
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user