提交 7be1e892 编写于 作者: S SteVen Batten

fixing labels in web

上级 ce6a5e3c
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
import { Registry } from 'vs/platform/registry/common/platform';
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { ILabelService } from 'vs/platform/label/common/label';
import { isWeb } from 'vs/base/common/platform';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
export class LabelContribution implements IWorkbenchContribution {
constructor(
@ILabelService private readonly labelService: ILabelService,
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService) {
this.registerFormatters();
}
private useWindowsPaths(): boolean {
if (this.environmentService.configuration.folderUri) {
return this.environmentService.configuration.folderUri.fsPath.indexOf('/') === -1;
}
if (this.environmentService.configuration.workspace) {
return this.environmentService.configuration.workspace.configPath.fsPath.indexOf('/') === -1;
}
return false;
}
private registerFormatters(): void {
if (isWeb) {
this.labelService.registerFormatter({
scheme: 'vscode-remote',
authority: this.environmentService.configuration.remoteAuthority,
formatting: {
label: '${path}',
separator: this.useWindowsPaths() ? '\\' : '/',
tildify: !this.useWindowsPaths()
}
});
}
}
}
const workbenchContributionsRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
workbenchContributionsRegistry.registerWorkbenchContribution(LabelContribution, LifecyclePhase.Starting);
\ No newline at end of file
......@@ -194,6 +194,9 @@ import 'vs/workbench/contrib/telemetry/browser/telemetry.contribution';
// Localizations
// import 'vs/workbench/contrib/localizations/browser/localizations.contribution';
// Labels
import 'vs/workbench/contrib/label/common/label.contribution';
// Preferences
import 'vs/workbench/contrib/preferences/browser/preferences.contribution';
import 'vs/workbench/contrib/preferences/browser/keybindingsEditorContribution';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册