Skip to content

API: add a preserveFocus boolean on `createTestRun #209491

Closed
@connor4312

Description

@connor4312

It's common that extensions trigger tests in various ways. Some of those may be user-initiated through UI actions outside of the built-in ones where focus should be transferred, some of them may be triggered in the background where focus should not be transferred. There have been a bunch of issues around this, on our tracker as well as those of community extensions.

I suggest adding an additional option to the TestRunRequest to allow extensions to hint whether focus should be preserved:

	export class TestRunRequest {
		/**
		 * 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;

Note this is on the TestRunRequest, not the individual TestRun. TestRunRequests can be created both by the the editor and extensions (if they initiate a test run), and this provides control for the latter case.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions