-
Notifications
You must be signed in to change notification settings - Fork 29.8k
/
codiconsUtil.ts
28 lines (24 loc) · 1.03 KB
/
codiconsUtil.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ThemeIcon } from 'vs/base/common/themables';
import { isString } from 'vs/base/common/types';
const _codiconFontCharacters: { [id: string]: number } = Object.create(null);
export function register(id: string, fontCharacter: number | string): ThemeIcon {
if (isString(fontCharacter)) {
const val = _codiconFontCharacters[fontCharacter];
if (val === undefined) {
throw new Error(`${id} references an unknown codicon: ${fontCharacter}`);
}
fontCharacter = val;
}
_codiconFontCharacters[id] = fontCharacter;
return { id };
}
/**
* Only to be used by the iconRegistry.
*/
export function getCodiconFontCharacters(): { [id: string]: number } {
return _codiconFontCharacters;
}