mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 11:38:51 +01:00
Fix #89993
This commit is contained in:
@@ -4,15 +4,14 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IOutputService, IOutputChannel, OUTPUT_PANEL_ID } from 'vs/workbench/contrib/output/common/output';
|
||||
import { IOutputService, IOutputChannel, OUTPUT_VIEW_ID } from 'vs/workbench/contrib/output/common/output';
|
||||
import { Extensions, IOutputChannelRegistry } from 'vs/workbench/services/output/common/output';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
|
||||
import { MainThreadOutputServiceShape, MainContext, IExtHostContext, ExtHostOutputServiceShape, ExtHostContext } from '../common/extHost.protocol';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
|
||||
import { UriComponents, URI } from 'vs/base/common/uri';
|
||||
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IViewsService } from 'vs/workbench/common/views';
|
||||
|
||||
@extHostNamedCustomer(MainContext.MainThreadOutputService)
|
||||
export class MainThreadOutputService extends Disposable implements MainThreadOutputServiceShape {
|
||||
@@ -21,28 +20,24 @@ export class MainThreadOutputService extends Disposable implements MainThreadOut
|
||||
|
||||
private readonly _proxy: ExtHostOutputServiceShape;
|
||||
private readonly _outputService: IOutputService;
|
||||
private readonly _layoutService: IWorkbenchLayoutService;
|
||||
private readonly _panelService: IPanelService;
|
||||
private readonly _viewsService: IViewsService;
|
||||
|
||||
constructor(
|
||||
extHostContext: IExtHostContext,
|
||||
@IOutputService outputService: IOutputService,
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
|
||||
@IPanelService panelService: IPanelService
|
||||
@IViewsService viewsService: IViewsService
|
||||
) {
|
||||
super();
|
||||
this._outputService = outputService;
|
||||
this._layoutService = layoutService;
|
||||
this._panelService = panelService;
|
||||
this._viewsService = viewsService;
|
||||
|
||||
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostOutputService);
|
||||
|
||||
const setVisibleChannel = () => {
|
||||
const panel = this._panelService.getActivePanel();
|
||||
const visibleChannel = panel && panel.getId() === OUTPUT_PANEL_ID ? this._outputService.getActiveChannel() : undefined;
|
||||
const visibleChannel = this._viewsService.isViewVisible(OUTPUT_VIEW_ID) ? this._outputService.getActiveChannel() : undefined;
|
||||
this._proxy.$setVisibleChannel(visibleChannel ? visibleChannel.id : null);
|
||||
};
|
||||
this._register(Event.any<any>(this._outputService.onActiveOutputChannel, this._panelService.onDidPanelOpen, this._panelService.onDidPanelClose)(() => setVisibleChannel()));
|
||||
this._register(Event.any<any>(this._outputService.onActiveOutputChannel, Event.filter(this._viewsService.onDidChangeViewVisibility, ({ id }) => id === OUTPUT_VIEW_ID))(() => setVisibleChannel()));
|
||||
setVisibleChannel();
|
||||
}
|
||||
|
||||
@@ -86,11 +81,10 @@ export class MainThreadOutputService extends Disposable implements MainThreadOut
|
||||
}
|
||||
|
||||
public $close(channelId: string): Promise<void> | undefined {
|
||||
const panel = this._panelService.getActivePanel();
|
||||
if (panel && panel.getId() === OUTPUT_PANEL_ID) {
|
||||
if (this._viewsService.isViewVisible(OUTPUT_VIEW_ID)) {
|
||||
const activeChannel = this._outputService.getActiveChannel();
|
||||
if (activeChannel && channelId === activeChannel.id) {
|
||||
this._layoutService.setPanelHidden(true);
|
||||
this._viewsService.closeView(OUTPUT_VIEW_ID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user