chore(vscode): update to 1.56.0

This commit is contained in:
Akash Satheesan
2021-04-30 20:25:17 +05:30
1749 changed files with 88014 additions and 43316 deletions

View File

@@ -3,14 +3,17 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { VSBuffer } from 'vs/base/common/buffer';
import { CancellationToken } from 'vs/base/common/cancellation';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import { isDefined } from 'vs/base/common/types';
import { URI, UriComponents } from 'vs/base/common/uri';
import { Range } from 'vs/editor/common/core/range';
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
import { getTestSubscriptionKey, ISerializedTestResults, ITestState, RunTestsRequest, TestDiffOpType, TestsDiff } from 'vs/workbench/contrib/testing/common/testCollection';
import { HydratedTestResult, ITestResultService, LiveTestResult } from 'vs/workbench/contrib/testing/common/testResultService';
import { TestResultState } from 'vs/workbench/api/common/extHostTypes';
import { ExtensionRunTestsRequest, getTestSubscriptionKey, ITestItem, ITestMessage, ITestRunTask, RunTestsRequest, TestDiffOpType, TestsDiff } from 'vs/workbench/contrib/testing/common/testCollection';
import { LiveTestResult } from 'vs/workbench/contrib/testing/common/testResult';
import { ITestResultService } from 'vs/workbench/contrib/testing/common/testResultService';
import { ITestRootProvider, ITestService } from 'vs/workbench/contrib/testing/common/testService';
import { ExtHostContext, ExtHostTestingResource, ExtHostTestingShape, IExtHostContext, MainContext, MainThreadTestingShape } from '../common/extHost.protocol';
@@ -44,7 +47,6 @@ export class MainThreadTesting extends Disposable implements MainThreadTestingSh
this._register(this.testService.onShouldSubscribe(args => this.proxy.$subscribeToTests(args.resource, args.uri)));
this._register(this.testService.onShouldUnsubscribe(args => this.proxy.$unsubscribeFromTests(args.resource, args.uri)));
const prevResults = resultService.results.map(r => r.toJSON()).filter(isDefined);
if (prevResults.length) {
this.proxy.$publishTestResults(prevResults);
@@ -68,31 +70,79 @@ export class MainThreadTesting extends Disposable implements MainThreadTestingSh
/**
* @inheritdoc
*/
public $publishExtensionProvidedResults(results: ISerializedTestResults, persist: boolean): void {
this.resultService.push(new HydratedTestResult(results, persist));
$addTestsToRun(runId: string, tests: ITestItem[]): void {
for (const test of tests) {
test.uri = URI.revive(test.uri);
if (test.range) {
test.range = Range.lift(test.range);
}
}
this.withLiveRun(runId, r => r.addTestChainToRun(tests));
}
/**
* @inheritdoc
*/
public $updateTestStateInRun(runId: string, testId: string, state: ITestState): void {
$startedExtensionTestRun(req: ExtensionRunTestsRequest): void {
this.resultService.createLiveResult(req);
}
/**
* @inheritdoc
*/
$startedTestRunTask(runId: string, task: ITestRunTask): void {
this.withLiveRun(runId, r => r.addTask(task));
}
/**
* @inheritdoc
*/
$finishedTestRunTask(runId: string, taskId: string): void {
this.withLiveRun(runId, r => r.markTaskComplete(taskId));
}
/**
* @inheritdoc
*/
$finishedExtensionTestRun(runId: string): void {
this.withLiveRun(runId, r => r.markComplete());
}
/**
* @inheritdoc
*/
public $updateTestStateInRun(runId: string, taskId: string, testId: string, state: TestResultState, duration?: number): void {
this.withLiveRun(runId, r => r.updateState(testId, taskId, state, duration));
}
/**
* @inheritdoc
*/
public $appendOutputToRun(runId: string, _taskId: string, output: VSBuffer): void {
this.withLiveRun(runId, r => r.output.append(output));
}
/**
* @inheritdoc
*/
public $appendTestMessageInRun(runId: string, taskId: string, testId: string, message: ITestMessage): void {
const r = this.resultService.getResult(runId);
if (r && r instanceof LiveTestResult) {
for (const message of state.messages) {
if (message.location) {
message.location.uri = URI.revive(message.location.uri);
message.location.range = Range.lift(message.location.range);
}
if (message.location) {
message.location.uri = URI.revive(message.location.uri);
message.location.range = Range.lift(message.location.range);
}
r.updateState(testId, state);
r.appendMessage(testId, taskId, message);
}
}
/**
* @inheritdoc
*/
public $registerTestProvider(id: string) {
public $registerTestController(id: string) {
const disposable = this.testService.registerTestController(id, {
runTests: (req, token) => this.proxy.$runTestsForProvider(req, token),
lookupTest: test => this.proxy.$lookupTest(test),
@@ -105,7 +155,7 @@ export class MainThreadTesting extends Disposable implements MainThreadTestingSh
/**
* @inheritdoc
*/
public $unregisterTestProvider(id: string) {
public $unregisterTestController(id: string) {
this.testProviderRegistrations.get(id)?.dispose();
this.testProviderRegistrations.delete(id);
}
@@ -142,11 +192,16 @@ export class MainThreadTesting extends Disposable implements MainThreadTestingSh
return result.id;
}
public dispose() {
public override dispose() {
super.dispose();
for (const subscription of this.testSubscriptions.values()) {
subscription.dispose();
}
this.testSubscriptions.clear();
}
private withLiveRun<T>(runId: string, fn: (run: LiveTestResult) => T): T | undefined {
const r = this.resultService.getResult(runId);
return r && r instanceof LiveTestResult ? fn(r) : undefined;
}
}