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

Consider unify the refresh action for test explorer #139737

Closed
jdneo opened this issue Dec 25, 2021 · 8 comments
Closed

Consider unify the refresh action for test explorer #139737

jdneo opened this issue Dec 25, 2021 · 8 comments
Assignees
Labels
api api-finalization insiders-released Patch has been released in VS Code Insiders testing Built-in testing support
Milestone

Comments

@jdneo
Copy link
Member

jdneo commented Dec 25, 2021

API Proposal: #139737 (comment)

Currently since the test explorer does not have refresh action by default. Extensions might contribute their own implementation for refresh, and thus, cause some UX conflicts. For example:

WeChat Screenshot_20211225105654

If user installed both Java and Python extension, the user will see two refresh button in the test explorer:

  • The one in the navigation bar is contributed by Python
  • The one in the overflow button is contributed by Java

And if Python extension is not activated, click on the navigation bar refresh button will cause an error.

This issue can be resolved if VS Code can unify the refresh action from the platform level

See: microsoft/vscode-java-test#1348

@nickzhums
Copy link
Member

@luabud for awareness, this seems to be affecting users who install both Java and Python extension

@connor4312
Copy link
Member

connor4312 commented Dec 29, 2021

Yep, agreed. I suggest an API such as this:

	export interface TestController {
		/**
		 * If this method is present, a refresh button will be present in the
		 * UI, and this method will be invoked when it's clicked. When called,
		 * the extension should scan the workspace for any new, changed, or
		 * removed tests.
		 *
		 * It's recommended that extensions try to update tests in realtime, using
		 * a {@link FileWatcher} for example, and use this method as a fallback.
		 *
		 * @returns A thenable that resolves when tests have been refreshed.
		 */
		refreshHandler: (() => Thenable<void> | void) | undefined;
	}

@connor4312 connor4312 added api api-proposal testing Built-in testing support labels Dec 29, 2021
@connor4312 connor4312 added this to the January 2022 milestone Dec 29, 2021
@luabud
Copy link
Member

luabud commented Dec 29, 2021

cc @karthiknadig

@connor4312
Copy link
Member

connor4312 commented Jan 6, 2022

The API is shipping in tomorrow's Insiders. Please give it a shot! It's a simple API and should be finalized next iteration.

Example of adopting it in the sample: microsoft/vscode-extension-samples@2f1d70f

connor4312 added a commit that referenced this issue Jan 6, 2022
@karthiknadig
Copy link
Member

@connor4312 Can this API and the UI support cancellation? Currently we show beaker-stop codicon when refreshing. We hide the refresh icon and show beaker-stop when triggered it cancels the refresh.

@connor4312
Copy link
Member

@karthiknadig added

@karthiknadig
Copy link
Member

@connor4312 Should this API be updated to take in cancellation token as well?

export function createTestController(id: string, label: string, refreshHandler?: () => Thenable<void> | void): TestController;

the API implementation here seems to be taking it:

createTestController(provider, label, refreshHandler?: (token: vscode.CancellationToken) => Thenable<void> | void) {

@connor4312
Copy link
Member

Oops, added that too

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api api-finalization insiders-released Patch has been released in VS Code Insiders testing Built-in testing support
Projects
None yet
Development

No branches or pull requests

6 participants
@connor4312 @karthiknadig @jdneo @luabud @nickzhums and others