1
>
/*---------------------------------------------------------------------------------------------
workspaceIdentifier.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 { hash } from '../../../base/common/hash.js';
7
>
import { URI } from '../../../base/common/uri.js';
8
>
import { ISingleFolderWorkspaceIdentifier, IWorkspaceIdentifier } from '../../workspace/common/workspace.js';
9
>
10
>
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11
>
// NOTE: DO NOT CHANGE. IDENTIFIERS HAVE TO REMAIN STABLE
12
>
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
13
>
14
>
export function getWorkspaceIdentifier(workspaceUri: URI): IWorkspaceIdentifier {
15
>
return {
16
>
id: getWorkspaceId(workspaceUri),
17
>
configPath: workspaceUri
18
>
};
19
>
}
20
>
21
>
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
22
>
// NOTE: DO NOT CHANGE. IDENTIFIERS HAVE TO REMAIN STABLE
23
>
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
24
>
25
>
export function getSingleFolderWorkspaceIdentifier(folderUri: URI): ISingleFolderWorkspaceIdentifier {
26
>
return {
27
>
id: getWorkspaceId(folderUri),
28
>
uri: folderUri
29
>
};
30
>
}
31
>
32
>
function getWorkspaceId(uri: URI): string {
33
>
return hash(uri.toString()).toString(16);
34
>
}