Skip to content

Commit

Permalink
Properly fix #134053 (#135347)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanp413 committed Oct 19, 2021
1 parent 8a4ed7f commit d817eda
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,6 @@ export class TerminalGroupService extends Disposable implements ITerminalGroupSe
}

async showPanel(focus?: boolean): Promise<void> {
if (this.instances.length === 0) {
return;
}
const pane = this._viewsService.getActiveViewWithId(TERMINAL_VIEW_ID)
?? await this._viewsService.openView(TERMINAL_VIEW_ID, focus);
pane?.setExpanded(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { listenStream } from 'vs/base/common/stream';
import { isDefined } from 'vs/base/common/types';
import { localize } from 'vs/nls';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IProcessDataEvent, IShellLaunchConfig, ITerminalChildProcess, ITerminalDimensionsOverride, ITerminalLaunchError, ProcessCapability, ProcessPropertyType, TerminalShellType } from 'vs/platform/terminal/common/terminal';
import { IProcessDataEvent, IShellLaunchConfig, ITerminalChildProcess, ITerminalDimensionsOverride, ITerminalLaunchError, ProcessCapability, ProcessPropertyType, TerminalLocation, TerminalShellType } from 'vs/platform/terminal/common/terminal';
import { IViewsService } from 'vs/workbench/common/views';
import { ITerminalGroupService, ITerminalInstance, ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal';
import { ITerminalEditorService, ITerminalGroupService, ITerminalInstance, ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal';
import { TERMINAL_VIEW_ID } from 'vs/workbench/contrib/terminal/common/terminal';
import { testingViewIcon } from 'vs/workbench/contrib/testing/browser/icons';
import { ITestResult } from 'vs/workbench/contrib/testing/common/testResult';
Expand Down Expand Up @@ -51,6 +51,7 @@ export class TestingOutputTerminalService implements ITestingOutputTerminalServi
constructor(
@ITerminalService private readonly terminalService: ITerminalService,
@ITerminalGroupService private readonly terminalGroupService: ITerminalGroupService,
@ITerminalEditorService private readonly terminalEditorService: ITerminalEditorService,
@ITestResultService resultService: ITestResultService,
@IViewsService private viewsService: IViewsService,
) {
Expand Down Expand Up @@ -89,7 +90,11 @@ export class TestingOutputTerminalService implements ITestingOutputTerminalServi
const existing = testOutputPtys.find(([, o]) => o.resultId === result?.id);
if (existing) {
this.terminalService.setActiveInstance(existing[0]);
this.terminalGroupService.showPanel();
if (existing[0].target === TerminalLocation.Editor) {
this.terminalEditorService.revealActiveEditor();
} else {
this.terminalGroupService.showPanel();
}
return;
}

Expand All @@ -116,7 +121,11 @@ export class TestingOutputTerminalService implements ITestingOutputTerminalServi
this.outputTerminals.set(terminal, output);
output.resetFor(result?.id, getTitle(result));
this.terminalService.setActiveInstance(terminal);
this.terminalGroupService.showPanel();
if (terminal.target === TerminalLocation.Editor) {
this.terminalEditorService.revealActiveEditor();
} else {
this.terminalGroupService.showPanel();
}

if (!result) {
// seems like it takes a tick for listeners to be registered
Expand Down

0 comments on commit d817eda

Please sign in to comment.