diff --git a/extensions/vscode-api-tests/package.json b/extensions/vscode-api-tests/package.json index b38c91ce1ce..beb65ffb2e6 100644 --- a/extensions/vscode-api-tests/package.json +++ b/extensions/vscode-api-tests/package.json @@ -45,7 +45,6 @@ "tunnels", "testCoverage", "testObserver", - "testMessageContextValue", "textSearchProvider", "timeline", "tokenInformation", diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index cd983bdc650..a58d049f563 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -1573,7 +1573,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I TestResultState: extHostTypes.TestResultState, TestRunRequest: extHostTypes.TestRunRequest, TestMessage: extHostTypes.TestMessage, - TestMessage2: extHostTypes.TestMessage, + TestMessage2: extHostTypes.TestMessage, // back compat for Oct 2023 TestTag: extHostTypes.TestTag, TestRunProfileKind: extHostTypes.TestRunProfileKind, TextSearchCompleteMessageType: TextSearchCompleteMessageType, diff --git a/src/vs/workbench/api/common/extHostTesting.ts b/src/vs/workbench/api/common/extHostTesting.ts index f8282d9b751..65dd87b6e3f 100644 --- a/src/vs/workbench/api/common/extHostTesting.ts +++ b/src/vs/workbench/api/common/extHostTesting.ts @@ -29,7 +29,6 @@ import { TestCommandId } from 'vs/workbench/contrib/testing/common/constants'; import { TestId, TestIdPathParts, TestPosition } from 'vs/workbench/contrib/testing/common/testId'; import { InvalidTestItemError } from 'vs/workbench/contrib/testing/common/testItemCollection'; import { AbstractIncrementalTestCollection, CoverageDetails, ICallProfileRunHandler, IFileCoverage, ISerializedTestResults, IStartControllerTests, IStartControllerTestsResult, ITestErrorMessage, ITestItem, ITestItemContext, ITestMessageMenuArgs, IncrementalChangeCollector, IncrementalTestCollectionItem, InternalTestItem, TestResultState, TestRunProfileBitset, TestsDiff, TestsDiffOp, isStartControllerTests } from 'vs/workbench/contrib/testing/common/testTypes'; -import { checkProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions'; import type * as vscode from 'vscode'; interface ControllerInfo { @@ -424,7 +423,6 @@ class TestRunTracker extends Disposable { constructor( private readonly dto: TestRunDto, private readonly proxy: MainThreadTestingShape, - private readonly extension: Readonly, parentToken?: CancellationToken, ) { super(); @@ -476,10 +474,6 @@ class TestRunTracker extends Disposable { ? messages.map(Convert.TestMessage.from) : [Convert.TestMessage.from(messages)]; - if (converted.some(c => c.contextValue !== undefined)) { - checkProposedApiEnabled(this.extension, 'testMessageContextValue'); - } - if (test.uri && test.range) { const defaultLocation: ILocationDto = { range: Convert.Range.from(test.range), uri: test.uri }; for (const message of converted) { @@ -690,7 +684,7 @@ export class TestRunCoordinator { } private getTracker(req: vscode.TestRunRequest, dto: TestRunDto, extension: IRelaxedExtensionDescription, token?: CancellationToken) { - const tracker = new TestRunTracker(dto, this.proxy, extension, token); + const tracker = new TestRunTracker(dto, this.proxy, token); this.tracked.set(req, tracker); Event.once(tracker.onEnd)(() => this.tracked.delete(req)); return tracker; diff --git a/src/vs/workbench/api/common/extHostTypeConverters.ts b/src/vs/workbench/api/common/extHostTypeConverters.ts index b3ba3306276..9f3cf0a2ffc 100644 --- a/src/vs/workbench/api/common/extHostTypeConverters.ts +++ b/src/vs/workbench/api/common/extHostTypeConverters.ts @@ -1833,7 +1833,7 @@ export namespace NotebookRendererScript { } export namespace TestMessage { - export function from(message: vscode.TestMessage2): ITestErrorMessage.Serialized { + export function from(message: vscode.TestMessage): ITestErrorMessage.Serialized { return { message: MarkdownString.fromStrict(message.message) || '', type: TestMessageType.Error, @@ -1844,7 +1844,7 @@ export namespace TestMessage { }; } - export function to(item: ITestErrorMessage.Serialized): vscode.TestMessage2 { + export function to(item: ITestErrorMessage.Serialized): vscode.TestMessage { const message = new types.TestMessage(typeof item.message === 'string' ? item.message : MarkdownString.to(item.message)); message.actualOutput = item.actual; message.expectedOutput = item.expected; diff --git a/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts b/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts index c5e30e4de43..3f07e089f9e 100644 --- a/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts +++ b/src/vs/workbench/services/extensions/common/extensionsApiProposals.ts @@ -95,7 +95,6 @@ export const allApiProposals = Object.freeze({ terminalQuickFixProvider: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalQuickFixProvider.d.ts', terminalSelection: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalSelection.d.ts', testCoverage: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testCoverage.d.ts', - testMessageContextValue: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testMessageContextValue.d.ts', testObserver: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testObserver.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', diff --git a/src/vscode-dts/vscode.d.ts b/src/vscode-dts/vscode.d.ts index f96413d1ae4..e0f4a73bd44 100644 --- a/src/vscode-dts/vscode.d.ts +++ b/src/vscode-dts/vscode.d.ts @@ -17610,6 +17610,37 @@ declare module 'vscode' { */ location?: Location; + /** + * Context value of the test item. This can be used to contribute message- + * specific actions to the test peek view. The value set here can be found + * in the `testMessage` property of the following `menus` contribution points: + * + * - `testing/message/context` - context menu for the message in the results tree + * - `testing/message/content` - a prominent button overlaying editor content where + * the message is displayed. + * + * For example: + * + * ```json + * "contributes": { + * "menus": { + * "testing/message/content": [ + * { + * "command": "extension.deleteCommentThread", + * "when": "testMessage == canApplyRichDiff" + * } + * ] + * } + * } + * ``` + * + * The command will be called with an object containing: + * - `test`: the {@link TestItem} the message is associated with, *if* it + * is still present in the {@link TestController.items} collection. + * - `message`: the {@link TestMessage} instance. + */ + contextValue?: string; + /** * Creates a new TestMessage that will present as a diff in the editor. * @param message Message to display to the user. diff --git a/src/vscode-dts/vscode.proposed.testMessageContextValue.d.ts b/src/vscode-dts/vscode.proposed.testMessageContextValue.d.ts deleted file mode 100644 index 515a99d0e2b..00000000000 --- a/src/vscode-dts/vscode.proposed.testMessageContextValue.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module 'vscode' { - - // https://github.com/microsoft/vscode/issues/190277 - - export class TestMessage2 extends TestMessage { - - /** - * Context value of the test item. This can be used to contribute message- - * specific actions to the test peek view. The value set here can be found - * in the `testMessage` property of the following `menus` contribution points: - * - * - `testing/message/context` - context menu for the message in the results tree - * - `testing/message/content` - a prominent button overlaying editor content where - * the message is displayed. - * - * For example: - * - * ```json - * "contributes": { - * "menus": { - * "testing/message/content": [ - * { - * "command": "extension.deleteCommentThread", - * "when": "testMessage == canApplyRichDiff" - * } - * ] - * } - * } - * ``` - * - * The command will be called with an object containing: - * - `test`: the {@link TestItem} the message is associated with, *if* it - * is still present in the {@link TestController.items} collection. - * - `message`: the {@link TestMessage} instance. - */ - contextValue?: string; - - // ... - } -}