Skip to content

Commit

Permalink
testing: finalize TestRunRequest.preserveFocus API
Browse files Browse the repository at this point in the history
Closes #209491
  • Loading branch information
connor4312 committed May 7, 2024
1 parent 3f91c9b commit c9cf92d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 34 deletions.
1 change: 0 additions & 1 deletion src/vs/workbench/api/common/extHost.api.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1679,7 +1679,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
LinkedEditingRanges: extHostTypes.LinkedEditingRanges,
TestResultState: extHostTypes.TestResultState,
TestRunRequest: extHostTypes.TestRunRequest,
TestRunRequest2: extHostTypes.TestRunRequest,
TestMessage: extHostTypes.TestMessage,
TestTag: extHostTypes.TestTag,
TestRunProfileKind: extHostTypes.TestRunProfileKind,
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/api/common/extHostTesting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export class ExtHostTesting extends Disposable implements ExtHostTestingShape {
}

await this.proxy.$runTests({
preserveFocus: (req as vscode.TestRunRequest2).preserveFocus ?? true,
preserveFocus: req.preserveFocus ?? true,
targets: [{
testIds: req.include?.map(t => TestId.fromExtHostTestItem(t, controller.collection.root.id).toString()) ?? [controller.collection.root.id],
profileGroup: profileGroupToBitset[profile.kind],
Expand Down Expand Up @@ -746,7 +746,7 @@ export class TestRunCoordinator {
exclude: request.exclude?.map(t => TestId.fromExtHostTestItem(t, collection.root.id).toString()) ?? [],
id: dto.id,
include: request.include?.map(t => TestId.fromExtHostTestItem(t, collection.root.id).toString()) ?? [collection.root.id],
preserveFocus: (request as vscode.TestRunRequest2).preserveFocus ?? true,
preserveFocus: request.preserveFocus ?? true,
persist
});

Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/api/common/extHostTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4023,7 +4023,7 @@ export enum TestRunProfileKind {
}

@es5ClassCompat
export class TestRunRequest implements vscode.TestRunRequest2 {
export class TestRunRequest implements vscode.TestRunRequest {
constructor(
public readonly include: vscode.TestItem[] | undefined = undefined,
public readonly exclude: vscode.TestItem[] | undefined = undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ export const allApiProposals = Object.freeze({
terminalSelection: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalSelection.d.ts',
terminalShellIntegration: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalShellIntegration.d.ts',
testObserver: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testObserver.d.ts',
testPreserveFocus: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testPreserveFocus.d.ts',
textSearchProvider: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchProvider.d.ts',
timeline: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.timeline.d.ts',
tokenInformation: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tokenInformation.d.ts',
Expand Down
11 changes: 10 additions & 1 deletion src/vscode-dts/vscode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17400,13 +17400,22 @@ declare module 'vscode' {
*/
readonly continuous?: boolean;

/**
* Controls how test Test Results view is focused. If true, the editor
* will keep the maintain the user's focus. If false, the editor will
* prefer to move focus into the Test Results view, although
* this may be configured by users.
*/
readonly preserveFocus: boolean;

/**
* @param include Array of specific tests to run, or undefined to run all tests
* @param exclude An array of tests to exclude from the run.
* @param profile The run profile used for this request.
* @param continuous Whether to run tests continuously as source changes.
* @param preserveFocus Whether to preserve the user's focus when the run is started
*/
constructor(include?: readonly TestItem[], exclude?: readonly TestItem[], profile?: TestRunProfile, continuous?: boolean);
constructor(include?: readonly TestItem[], exclude?: readonly TestItem[], profile?: TestRunProfile, continuous?: boolean, preserveFocus?: boolean);
}

/**
Expand Down
28 changes: 0 additions & 28 deletions src/vscode-dts/vscode.proposed.testPreserveFocus.d.ts

This file was deleted.

0 comments on commit c9cf92d

Please sign in to comment.