testing: update test item async resolving

See https://github.com/microsoft/vscode/issues/126987#issuecomment-867031454
This commit makes the following changes:

- Keep the `resolveChildrenHandler`, and remove the CancellationToken parameter
- Remove `TestITem.status` and instead have `TestItem.canResolveChildren?: boolean`
- Add `TestItem.busy?: boolean`. Note that the UI would implicitly show
  the item as busy while `resolve` is being called. (This is a new feature)

Upgrading to account for these changes should take around 10 to 20 minutes:

1. Where you previously set `item.status = vscode.TestItemStatus.Pending`,
   instead set `item.canResolveChildren = true`.
2. If you used the cancellation token in resolveChildrenHandler, you no
   longer need to do so. What you do here instead is up to you:

	 - If you set up global workspace watchers, add those to `context.subscriptions`
	 - You _probably_ don't need to set up watchers for "file" test items,
	   since you will receive updates via `vscode.workspace.onDidChangeTextDocument`
		 and/or any FileWatcher you have set up.

Example of an update: 7287c64bf7
This commit is contained in:
Connor Peet
2021-06-23 12:45:23 -07:00
parent fb551dd655
commit df5cd47784
8 changed files with 80 additions and 94 deletions

View File

@@ -1273,7 +1273,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
NotebookControllerAffinity: extHostTypes.NotebookControllerAffinity,
PortAttributes: extHostTypes.PortAttributes,
LinkedEditingRanges: extHostTypes.LinkedEditingRanges,
TestItemStatus: extHostTypes.TestItemStatus,
TestResultState: extHostTypes.TestResultState,
TestRunRequest: extHostTypes.TestRunRequest,
TestMessage: extHostTypes.TestMessage,