Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/api/common/extHostLabelService.ts
3296 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
6
import { ResourceLabelFormatter } from '../../../platform/label/common/label.js';
7
import { IDisposable, toDisposable } from '../../../base/common/lifecycle.js';
8
import { MainThreadLabelServiceShape, ExtHostLabelServiceShape, MainContext, IMainContext } from './extHost.protocol.js';
9
10
export class ExtHostLabelService implements ExtHostLabelServiceShape {
11
12
private readonly _proxy: MainThreadLabelServiceShape;
13
private _handlePool: number = 0;
14
15
constructor(mainContext: IMainContext) {
16
this._proxy = mainContext.getProxy(MainContext.MainThreadLabelService);
17
}
18
19
$registerResourceLabelFormatter(formatter: ResourceLabelFormatter): IDisposable {
20
const handle = this._handlePool++;
21
this._proxy.$registerResourceLabelFormatter(handle, formatter);
22
23
return toDisposable(() => {
24
this._proxy.$unregisterResourceLabelFormatter(handle);
25
});
26
}
27
}
28