Skip to content

Commit

Permalink
testing: better support controllers who don't parse unsaved files
Browse files Browse the repository at this point in the history
Fixes #133441
  • Loading branch information
connor4312 committed Oct 7, 2021
1 parent c867ac7 commit 456296f
Show file tree
Hide file tree
Showing 6 changed files with 466 additions and 291 deletions.
10 changes: 8 additions & 2 deletions src/vs/workbench/contrib/testing/browser/testing.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { Extensions as WorkbenchExtensions, IWorkbenchContributionsRegistry } fr
import { Extensions as ViewContainerExtensions, IViewContainersRegistry, IViewsRegistry, IViewsService, ViewContainerLocation } from 'vs/workbench/common/views';
import { REVEAL_IN_EXPLORER_COMMAND_ID } from 'vs/workbench/contrib/files/browser/fileCommands';
import { testingViewIcon } from 'vs/workbench/contrib/testing/browser/icons';
import { TestingDecorations } from 'vs/workbench/contrib/testing/browser/testingDecorations';
import { TestingDecorations, TestingDecorationService } from 'vs/workbench/contrib/testing/browser/testingDecorations';
import { TestingExplorerView } from 'vs/workbench/contrib/testing/browser/testingExplorerView';
import { CloseTestPeek, GoToNextMessageAction, GoToPreviousMessageAction, OpenMessageInEditorAction, TestingOutputPeekController, TestingPeekOpener, ToggleTestingPeekHistory } from 'vs/workbench/contrib/testing/browser/testingOutputPeek';
import { ITestingOutputTerminalService, TestingOutputTerminalService } from 'vs/workbench/contrib/testing/browser/testingOutputTerminalService';
Expand All @@ -34,6 +34,7 @@ import { TestId, TestPosition } from 'vs/workbench/contrib/testing/common/testId
import { ITestingAutoRun, TestingAutoRun } from 'vs/workbench/contrib/testing/common/testingAutoRun';
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';
Expand All @@ -53,6 +54,7 @@ registerSingleton(ITestingAutoRun, TestingAutoRun, true);
registerSingleton(ITestingOutputTerminalService, TestingOutputTerminalService, true);
registerSingleton(ITestingPeekOpener, TestingPeekOpener, true);
registerSingleton(ITestingProgressUiService, TestingProgressUiService, true);
registerSingleton(ITestingDecorationsService, TestingDecorationService, true);

const viewContainer = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer({
id: Testing.ViewletId,
Expand Down Expand Up @@ -160,11 +162,15 @@ CommandsRegistry.registerCommand({
const fileService = accessor.get(IFileService);
const openerService = accessor.get(IOpenerService);

const { range, uri } = test.item;
let { range, uri } = test.item;
if (!uri) {
return;
}

// If an editor has the file open, there are decorations. Try to adjust the
// revealed range to those decorations (#133441).
range = accessor.get(ITestingDecorationsService).getDecoratedRangeForTest(uri, extId) || range;

accessor.get(ITestExplorerFilterState).reveal.value = extId;
accessor.get(ITestingPeekOpener).closeAllPeeks();

Expand Down
Loading

0 comments on commit 456296f

Please sign in to comment.