1
>
/*---------------------------------------------------------------------------------------------
workspaceTags.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { WorkbenchState, IWorkspace } from '../../../../platform/workspace/common/workspace.js';
7
>
import { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';
8
>
import { URI } from '../../../../base/common/uri.js';
9
>
import { getRemotes } from '../../../../platform/extensionManagement/common/configRemotes.js';
10
>
11
>
export type Tags = { [index: string]: boolean | number | string | undefined };
12
>
13
>
export const IWorkspaceTagsService = createDecorator<IWorkspaceTagsService>('workspaceTagsService');
14
>
15
>
export interface IWorkspaceTagsService {
16
>
readonly _serviceBrand: undefined;
17
>
18
>
getTags(): Promise<Tags>;
19
>
20
>
/**
21
>
* Returns an id for the workspace, different from the id returned by the context service. A hash based
22
>
* on the folder uri or workspace configuration, not time-based, and undefined for empty workspaces.
23
>
*/
24
>
getTelemetryWorkspaceId(workspace: IWorkspace, state: WorkbenchState): Promise<string | undefined>;
25
>
26
>
getHashedRemotesFromUri(workspaceUri: URI, stripEndingDotGit?: boolean): Promise<string[]>;
27
>
}
28
>
29
>
export async function getHashedRemotesFromConfig(text: string, stripEndingDotGit: boolean = false, sha1Hex: (str: string) => Promise<string>): Promise<string[]> {
30
>
return Promise.all(getRemotes(text, stripEndingDotGit).map(remote => sha1Hex(remote)));
31
>
}