Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/base/common/codiconsUtil.ts
3291 views
1
/*---------------------------------------------------------------------------------------------
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
import { ThemeIcon } from './themables.js';
6
import { isString } from './types.js';
7
8
9
const _codiconFontCharacters: { [id: string]: number } = Object.create(null);
10
11
export function register(id: string, fontCharacter: number | string): ThemeIcon {
12
if (isString(fontCharacter)) {
13
const val = _codiconFontCharacters[fontCharacter];
14
if (val === undefined) {
15
throw new Error(`${id} references an unknown codicon: ${fontCharacter}`);
16
}
17
fontCharacter = val;
18
}
19
_codiconFontCharacters[id] = fontCharacter;
20
return { id };
21
}
22
23
/**
24
* Only to be used by the iconRegistry.
25
*/
26
export function getCodiconFontCharacters(): { [id: string]: number } {
27
return _codiconFontCharacters;
28
}
29
30