Path: blob/main/src/vs/workbench/api/common/extHostLabelService.ts
3296 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { ResourceLabelFormatter } from '../../../platform/label/common/label.js';6import { IDisposable, toDisposable } from '../../../base/common/lifecycle.js';7import { MainThreadLabelServiceShape, ExtHostLabelServiceShape, MainContext, IMainContext } from './extHost.protocol.js';89export class ExtHostLabelService implements ExtHostLabelServiceShape {1011private readonly _proxy: MainThreadLabelServiceShape;12private _handlePool: number = 0;1314constructor(mainContext: IMainContext) {15this._proxy = mainContext.getProxy(MainContext.MainThreadLabelService);16}1718$registerResourceLabelFormatter(formatter: ResourceLabelFormatter): IDisposable {19const handle = this._handlePool++;20this._proxy.$registerResourceLabelFormatter(handle, formatter);2122return toDisposable(() => {23this._proxy.$unregisterResourceLabelFormatter(handle);24});25}26}2728