Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: remove old test output terminal #185405

Merged
merged 1 commit into from
Jun 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 4 additions & 25 deletions src/vs/workbench/contrib/testing/browser/testExplorerActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { VIEWLET_ID as EXTENSIONS_VIEWLET_ID, IExtensionsViewPaneContainer } fro
import { IActionableTestTreeElement, TestExplorerTreeElement, TestItemTreeElement } from 'vs/workbench/contrib/testing/browser/explorerProjections/index';
import * as icons from 'vs/workbench/contrib/testing/browser/icons';
import { TestingExplorerView } from 'vs/workbench/contrib/testing/browser/testingExplorerView';
import { ITestingOutputTerminalService } from 'vs/workbench/contrib/testing/browser/testingOutputTerminalService';
import { TestResultsView } from 'vs/workbench/contrib/testing/browser/testingOutputPeek';
import { TestingConfigKeys, getTestingConfiguration } from 'vs/workbench/contrib/testing/common/configuration';
import { TestCommandId, TestExplorerViewMode, TestExplorerViewSorting, Testing, testConfigurationGroupNames } from 'vs/workbench/contrib/testing/common/constants';
import { TestId } from 'vs/workbench/contrib/testing/common/testId';
Expand Down Expand Up @@ -840,30 +840,9 @@ export class ShowMostRecentOutputAction extends Action2 {
}

public async run(accessor: ServicesAccessor) {
const quickInputService = accessor.get(IQuickInputService);
const terminalOutputService = accessor.get(ITestingOutputTerminalService);
const result = accessor.get(ITestResultService).results[0];

if (!result.tasks.length) {
return;
}

let index = 0;
if (result.tasks.length > 1) {
const picked = await quickInputService.pick(
result.tasks.map((t, i) => ({ label: t.name || localize('testing.pickTaskUnnamed', "Run #{0}", i), index: i })),
{ placeHolder: localize('testing.pickTask', "Pick a run to show output for") }
);

if (!picked) {
return;
}

index = picked.index;
}


terminalOutputService.open(result, index);
const viewService = accessor.get(IViewsService);
const testView = await viewService.openView<TestResultsView>(Testing.ResultsViewId, true);
testView?.showLatestRun();
}
}

Expand Down
22 changes: 10 additions & 12 deletions src/vs/workbench/contrib/testing/browser/testing.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,43 +16,41 @@ import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { IProgressService } from 'vs/platform/progress/common/progress';
import { Registry } from 'vs/platform/registry/common/platform';
import { Extensions as WorkbenchExtensions, IWorkbenchContributionsRegistry } from 'vs/workbench/common/contributions';
import { Extensions as ViewContainerExtensions, IViewContainersRegistry, IViewsRegistry, IViewsService, ViewContainerLocation } from 'vs/workbench/common/views';
import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer';
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
import { IViewContainersRegistry, IViewsRegistry, IViewsService, Extensions as ViewContainerExtensions, ViewContainerLocation } from 'vs/workbench/common/views';
import { REVEAL_IN_EXPLORER_COMMAND_ID } from 'vs/workbench/contrib/files/browser/fileConstants';
import { testingResultsIcon, testingViewIcon } from 'vs/workbench/contrib/testing/browser/icons';
import { TestingDecorations, TestingDecorationService } from 'vs/workbench/contrib/testing/browser/testingDecorations';
import { TestingDecorationService, TestingDecorations } from 'vs/workbench/contrib/testing/browser/testingDecorations';
import { TestingExplorerView } from 'vs/workbench/contrib/testing/browser/testingExplorerView';
import { CloseTestPeek, GoToNextMessageAction, GoToPreviousMessageAction, OpenMessageInEditorAction, TestResultsView, TestingOutputPeekController, TestingPeekOpener, ToggleTestingPeekHistory } from 'vs/workbench/contrib/testing/browser/testingOutputPeek';
import { ITestingOutputTerminalService, TestingOutputTerminalService } from 'vs/workbench/contrib/testing/browser/testingOutputTerminalService';
import { ITestingProgressUiService, TestingProgressTrigger, TestingProgressUiService } from 'vs/workbench/contrib/testing/browser/testingProgressUiService';
import { TestingViewPaneContainer } from 'vs/workbench/contrib/testing/browser/testingViewPaneContainer';
import { testingConfiguration } from 'vs/workbench/contrib/testing/common/configuration';
import { TestCommandId, Testing } from 'vs/workbench/contrib/testing/common/constants';
import { ITestItem, TestRunProfileBitset } from 'vs/workbench/contrib/testing/common/testTypes';
import { ITestExplorerFilterState, TestExplorerFilterState } from 'vs/workbench/contrib/testing/common/testExplorerFilterState';
import { TestId, TestPosition } from 'vs/workbench/contrib/testing/common/testId';
import { TestingContentProvider } from 'vs/workbench/contrib/testing/common/testingContentProvider';
import { TestingContextKeys } from 'vs/workbench/contrib/testing/common/testingContextKeys';
import { ITestingDecorationsService } from 'vs/workbench/contrib/testing/common/testingDecorations';
import { ITestingPeekOpener } from 'vs/workbench/contrib/testing/common/testingPeekOpener';
import { ITestProfileService, TestProfileService } from 'vs/workbench/contrib/testing/common/testProfileService';
import { ITestResultService, TestResultService } from 'vs/workbench/contrib/testing/common/testResultService';
import { ITestResultStorage, TestResultStorage } from 'vs/workbench/contrib/testing/common/testResultStorage';
import { ITestService } from 'vs/workbench/contrib/testing/common/testService';
import { TestService } from 'vs/workbench/contrib/testing/common/testServiceImpl';
import { ITestItem, TestRunProfileBitset } from 'vs/workbench/contrib/testing/common/testTypes';
import { TestingContentProvider } from 'vs/workbench/contrib/testing/common/testingContentProvider';
import { TestingContextKeys } from 'vs/workbench/contrib/testing/common/testingContextKeys';
import { ITestingContinuousRunService, TestingContinuousRunService } from 'vs/workbench/contrib/testing/common/testingContinuousRunService';
import { ITestingDecorationsService } from 'vs/workbench/contrib/testing/common/testingDecorations';
import { ITestingPeekOpener } from 'vs/workbench/contrib/testing/common/testingPeekOpener';
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
import { allTestActions, discoverAndRunTests } from './testExplorerActions';
import './testingConfigurationUi';
import { ITestingContinuousRunService, TestingContinuousRunService } from 'vs/workbench/contrib/testing/common/testingContinuousRunService';
import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer';

registerSingleton(ITestService, TestService, InstantiationType.Delayed);
registerSingleton(ITestResultStorage, TestResultStorage, InstantiationType.Delayed);
registerSingleton(ITestProfileService, TestProfileService, InstantiationType.Delayed);
registerSingleton(ITestingContinuousRunService, TestingContinuousRunService, InstantiationType.Delayed);
registerSingleton(ITestResultService, TestResultService, InstantiationType.Delayed);
registerSingleton(ITestExplorerFilterState, TestExplorerFilterState, InstantiationType.Delayed);
registerSingleton(ITestingOutputTerminalService, TestingOutputTerminalService, InstantiationType.Delayed);
registerSingleton(ITestingPeekOpener, TestingPeekOpener, InstantiationType.Delayed);
registerSingleton(ITestingProgressUiService, TestingProgressUiService, InstantiationType.Delayed);
registerSingleton(ITestingDecorationsService, TestingDecorationService, InstantiationType.Delayed);
Expand Down
34 changes: 17 additions & 17 deletions src/vs/workbench/contrib/testing/browser/testingOutputPeek.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ import { TERMINAL_BACKGROUND_COLOR } from 'vs/workbench/contrib/terminal/common/
import { flatTestItemDelimiter } from 'vs/workbench/contrib/testing/browser/explorerProjections/display';
import { getTestItemContextOverlay } from 'vs/workbench/contrib/testing/browser/explorerProjections/testItemContextOverlay';
import * as icons from 'vs/workbench/contrib/testing/browser/icons';
import { ITestingOutputTerminalService } from 'vs/workbench/contrib/testing/browser/testingOutputTerminalService';
import { testingPeekBorder, testingPeekHeaderBackground } from 'vs/workbench/contrib/testing/browser/theme';
import { AutoOpenPeekViewWhen, TestingConfigKeys, getTestingConfiguration } from 'vs/workbench/contrib/testing/common/configuration';
import { Testing } from 'vs/workbench/contrib/testing/common/constants';
Expand Down Expand Up @@ -945,6 +944,18 @@ export class TestResultsView extends ViewPane {
return this.content.current;
}

public showLatestRun(preserveFocus = false) {
const result = this.resultService.results.find(r => r.tasks.length);
if (!result) {
return;
}

this.content.reveal({
preserveFocus,
subject: new TaskSubject(result.id, 0),
});
}

protected override renderBody(container: HTMLElement): void {
super.renderBody(container);
this.content.fillBody(container);
Expand Down Expand Up @@ -1517,7 +1528,7 @@ class OutputPeekTree extends Disposable {
) {
super();

this.treeActions = instantiationService.createInstance(TreeActionsProvider, options.showRevealLocationOnMessages);
this.treeActions = instantiationService.createInstance(TreeActionsProvider, options.showRevealLocationOnMessages, this.requestReveal,);
const diffIdentityProvider: IIdentityProvider<TreeElement> = {
getId(e: TreeElement) {
return e.id;
Expand Down Expand Up @@ -1718,9 +1729,7 @@ class OutputPeekTree extends Disposable {
}));

this._register(this.tree.onDidOpen(async e => {
if (e.element instanceof TaskElement) {
this.requestReveal.fire(new TaskSubject(e.element.results.id, e.element.index));
} else if (e.element instanceof TestMessageElement) {
if (e.element instanceof TestMessageElement) {
this.requestReveal.fire(new MessageSubject(e.element.result.id, e.element.test, e.element.taskIndex, e.element.messageIndex));
}
}));
Expand Down Expand Up @@ -1852,8 +1861,8 @@ class TestRunElementRenderer implements ICompressibleTreeRenderer<ITreeElement,
class TreeActionsProvider {
constructor(
private readonly showRevealLocationOnMessages: boolean,
private readonly requestReveal: Emitter<InspectSubject>,
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@ITestingOutputTerminalService private readonly testTerminalService: ITestingOutputTerminalService,
@IMenuService private readonly menuService: IMenuService,
@ICommandService private readonly commandService: ICommandService,
@ITestProfileService private readonly testProfileService: ITestProfileService,
Expand All @@ -1880,7 +1889,7 @@ class TreeActionsProvider {
localize('testing.showResultOutput', "Show Result Output"),
ThemeIcon.asClassName(Codicon.terminal),
undefined,
() => this.testTerminalService.open(element.results, element.index)
() => this.requestReveal.fire(new TaskSubject(element.results.id, element.index)),
));
}

Expand All @@ -1892,7 +1901,7 @@ class TreeActionsProvider {
localize('testing.showResultOutput', "Show Result Output"),
ThemeIcon.asClassName(Codicon.terminal),
undefined,
() => this.testTerminalService.open(element.value, 0)
() => this.requestReveal.fire(new TaskSubject(element.value.id, 0)),
));
}

Expand Down Expand Up @@ -1970,15 +1979,6 @@ class TreeActionsProvider {
}),
));
}
if (element.marker !== undefined) {
primary.push(new Action(
'testing.outputPeek.showMessageInTerminal',
localize('testing.showMessageInTerminal', "Show Output in Terminal"),
ThemeIcon.asClassName(Codicon.terminal),
undefined,
() => this.testTerminalService.open(element.result, element.taskIndex, element.marker),
));
}
}

const result = { primary, secondary };
Expand Down