labelService: register formatters via API. Also expose getSeperator

This commit is contained in:
isidor
2019-02-21 10:01:52 +01:00
parent 2c75fe1906
commit 835458245d
12 changed files with 69 additions and 28 deletions

View File

@@ -112,6 +112,7 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
private readonly _watches = new Map<number, IDisposable>();
private _linkProviderRegistration: IDisposable;
// Used as a handle both for file system providers and resource label formatters (being lazy)
private _handlePool: number = 0;
constructor(mainContext: IMainContext, private _extHostLanguageFeatures: ExtHostLanguageFeatures) {
@@ -204,8 +205,13 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
});
}
setUriFormatter(formatter: ResourceLabelFormatter): void {
this._proxy.$setUriFormatter(formatter);
registerResourceLabelFormatter(formatter: ResourceLabelFormatter): IDisposable {
const handle = this._handlePool++;
this._proxy.$registerResourceLabelFormatter(handle, formatter);
return toDisposable(() => {
this._proxy.$unregisterResourceLabelFormatter(handle);
});
}
private static _asIStat(stat: vscode.FileStat): files.IStat {