Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/util/vs/base/common/codiconsUtil.ts
13405 views
1
//!!! DO NOT modify, this file was COPIED from 'microsoft/vscode'
2
3
/*---------------------------------------------------------------------------------------------
4
* Copyright (c) Microsoft Corporation. All rights reserved.
5
* Licensed under the MIT License. See License.txt in the project root for license information.
6
*--------------------------------------------------------------------------------------------*/
7
import { ThemeIcon } from './themables';
8
import { isString } from './types';
9
10
11
const _codiconFontCharacters: { [id: string]: number } = Object.create(null);
12
13
export function register(id: string, fontCharacter: number | string): ThemeIcon {
14
if (isString(fontCharacter)) {
15
const val = _codiconFontCharacters[fontCharacter];
16
if (val === undefined) {
17
throw new Error(`${id} references an unknown codicon: ${fontCharacter}`);
18
}
19
fontCharacter = val;
20
}
21
_codiconFontCharacters[id] = fontCharacter;
22
return { id };
23
}
24
25
/**
26
* Only to be used by the iconRegistry.
27
*/
28
export function getCodiconFontCharacters(): { [id: string]: number } {
29
return _codiconFontCharacters;
30
}
31
32