diff --git a/src/vs/workbench/api/common/extHostTypeConverters.ts b/src/vs/workbench/api/common/extHostTypeConverters.ts index e47c784fa9f06f..cc43c4ad3e8e75 100644 --- a/src/vs/workbench/api/common/extHostTypeConverters.ts +++ b/src/vs/workbench/api/common/extHostTypeConverters.ts @@ -33,7 +33,7 @@ import { SaveReason } from 'vs/workbench/common/editor'; import * as notebooks from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { ICellRange } from 'vs/workbench/contrib/notebook/common/notebookRange'; import * as search from 'vs/workbench/contrib/search/common/search'; -import { CoverageDetails, DetailType, ICoveredCount, IFileCoverage, ISerializedTestResults, ITestErrorMessage, ITestItem, ITestItemContext, ITestTag, SerializedTestErrorMessage, SerializedTestResultItem, TestMessageType } from 'vs/workbench/contrib/testing/common/testCollection'; +import { CoverageDetails, denamespaceTestTag, DetailType, ICoveredCount, IFileCoverage, ISerializedTestResults, ITestErrorMessage, ITestItem, ITestItemContext, ITestTag, namespaceTestTag, SerializedTestErrorMessage, SerializedTestResultItem, TestMessageType } from 'vs/workbench/contrib/testing/common/testCollection'; import { TestId } from 'vs/workbench/contrib/testing/common/testId'; import { EditorGroupColumn } from 'vs/workbench/services/editor/common/editorGroupColumn'; import { ACTIVE_GROUP, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService'; @@ -1700,17 +1700,9 @@ export namespace TestMessage { } export namespace TestTag { - const enum Constants { - Delimiter = '\0', - } - - export const namespace = (ctrlId: string, tagId: string) => - ctrlId + Constants.Delimiter + tagId; + export const namespace = namespaceTestTag; - export const denamespace = (namespaced: string) => { - const index = namespaced.indexOf(Constants.Delimiter); - return { ctrlId: namespaced.slice(0, index), tagId: namespaced.slice(index + 1) }; - }; + export const denamespace = denamespaceTestTag; } export namespace TestItem { diff --git a/src/vs/workbench/contrib/testing/browser/testingExplorerFilter.ts b/src/vs/workbench/contrib/testing/browser/testingExplorerFilter.ts index d2afbf5bd3fb67..23832ee3205393 100644 --- a/src/vs/workbench/contrib/testing/browser/testingExplorerFilter.ts +++ b/src/vs/workbench/contrib/testing/browser/testingExplorerFilter.ts @@ -17,11 +17,11 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'; import { IThemeService, ThemeIcon } from 'vs/platform/theme/common/themeService'; -import { TestTag } from 'vs/workbench/api/common/extHostTypeConverters'; import { attachSuggestEnabledInputBoxStyler, ContextScopedSuggestEnabledInputWithHistory, SuggestEnabledInputWithHistory, SuggestResultsProvider } from 'vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput'; import { testingFilterIcon } from 'vs/workbench/contrib/testing/browser/icons'; import { Testing } from 'vs/workbench/contrib/testing/common/constants'; import { StoredValue } from 'vs/workbench/contrib/testing/common/storedValue'; +import { denamespaceTestTag } from 'vs/workbench/contrib/testing/common/testCollection'; import { ITestExplorerFilterState, TestFilterTerm } from 'vs/workbench/contrib/testing/common/testExplorerFilterState'; import { ITestService } from 'vs/workbench/contrib/testing/common/testService'; @@ -74,7 +74,7 @@ export class TestingExplorerFilter extends BaseActionViewItem { provideResults: () => [ ...Object.entries(testFilterDescriptions).map(([label, detail]) => ({ label, detail })), ...Iterable.map(this.testService.collection.tags.values(), tag => { - const { ctrlId, tagId } = TestTag.denamespace(tag.id); + const { ctrlId, tagId } = denamespaceTestTag(tag.id); const insertText = `@${ctrlId}:${tagId}`; return ({ label: `@${ctrlId}:${tagId}`, diff --git a/src/vs/workbench/contrib/testing/browser/testingProgressUiService.ts b/src/vs/workbench/contrib/testing/browser/testingProgressUiService.ts index ddbbd0b9e6d394..77ac8c24841b04 100644 --- a/src/vs/workbench/contrib/testing/browser/testingProgressUiService.ts +++ b/src/vs/workbench/contrib/testing/browser/testingProgressUiService.ts @@ -10,10 +10,10 @@ import { localize } from 'vs/nls'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { createDecorator, IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { ProgressLocation, UnmanagedProgress } from 'vs/platform/progress/common/progress'; -import { TestResultState } from 'vs/workbench/api/common/extHostTypes'; import { ViewContainerLocation } from 'vs/workbench/common/views'; import { AutoOpenTesting, getTestingConfiguration, TestingConfigKeys } from 'vs/workbench/contrib/testing/common/configuration'; import { Testing } from 'vs/workbench/contrib/testing/common/constants'; +import { TestResultState } from 'vs/workbench/contrib/testing/common/testCollection'; import { isFailedState } from 'vs/workbench/contrib/testing/common/testingStates'; import { LiveTestResult, TestResultItemChangeReason, TestStateCount } from 'vs/workbench/contrib/testing/common/testResult'; import { ITestResultService } from 'vs/workbench/contrib/testing/common/testResultService'; diff --git a/src/vs/workbench/contrib/testing/common/testCollection.ts b/src/vs/workbench/contrib/testing/common/testCollection.ts index 31a63d028178b9..1bb6f1dcb88046 100644 --- a/src/vs/workbench/contrib/testing/common/testCollection.ts +++ b/src/vs/workbench/contrib/testing/common/testCollection.ts @@ -8,7 +8,7 @@ import { MarshalledId } from 'vs/base/common/marshalling'; import { URI } from 'vs/base/common/uri'; import { IPosition } from 'vs/editor/common/core/position'; import { IRange, Range } from 'vs/editor/common/core/range'; -import { ILocationDto } from 'vs/workbench/api/common/extHost.protocol'; +import { Dto } from 'vs/workbench/services/extensions/common/proxyIdentifier'; export const enum TestResultState { Unset = 0, @@ -112,7 +112,7 @@ export interface ITestErrorMessage { location: IRichLocation | undefined; } -export type SerializedTestErrorMessage = Omit & { location?: ILocationDto }; +export type SerializedTestErrorMessage = Omit & { location?: Dto }; export interface ITestOutputMessage { message: string; @@ -121,7 +121,7 @@ export interface ITestOutputMessage { location: IRichLocation | undefined; } -export type SerializedTestOutputMessage = Omit & { location?: ILocationDto }; +export type SerializedTestOutputMessage = Omit & { location?: Dto }; export type SerializedTestMessage = SerializedTestErrorMessage | SerializedTestOutputMessage; @@ -143,6 +143,16 @@ export interface ITestTag { id: string; } +const testTagDelimiter = '\0'; + +export const namespaceTestTag = + (ctrlId: string, tagId: string) => ctrlId + testTagDelimiter + tagId; + +export const denamespaceTestTag = (namespaced: string) => { + const index = namespaced.indexOf(testTagDelimiter); + return { ctrlId: namespaced.slice(0, index), tagId: namespaced.slice(index + 1) }; +}; + export interface ITestTagDisplayInfo { id: string; ctrlLabel: string; diff --git a/src/vs/workbench/contrib/testing/common/testExplorerFilterState.ts b/src/vs/workbench/contrib/testing/common/testExplorerFilterState.ts index bff4bd12c716f0..2f5f78039ca140 100644 --- a/src/vs/workbench/contrib/testing/common/testExplorerFilterState.ts +++ b/src/vs/workbench/contrib/testing/common/testExplorerFilterState.ts @@ -5,8 +5,8 @@ import { Emitter, Event } from 'vs/base/common/event'; import { splitGlobAware } from 'vs/base/common/glob'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; -import { TestTag } from 'vs/workbench/api/common/extHostTypeConverters'; import { IObservableValue, MutableObservableValue } from 'vs/workbench/contrib/testing/common/observableValue'; +import { namespaceTestTag } from 'vs/workbench/contrib/testing/common/testCollection'; export interface ITestExplorerFilterState { _serviceBrand: undefined; @@ -134,9 +134,9 @@ export class TestExplorerFilterState implements ITestExplorerFilterState { } if (match[0].startsWith('!')) { - this.excludeTags.add(TestTag.namespace(match[1], tagId)); + this.excludeTags.add(namespaceTestTag(match[1], tagId)); } else { - this.includeTags.add(TestTag.namespace(match[1], tagId)); + this.includeTags.add(namespaceTestTag(match[1], tagId)); } nextIndex++; }