diff --git a/src/vs/base/common/labels.ts b/src/vs/base/common/labels.ts index 44d9373ab80..3e50bf58495 100644 --- a/src/vs/base/common/labels.ts +++ b/src/vs/base/common/labels.ts @@ -23,7 +23,7 @@ export interface IUserHomeProvider { } /** - * @deprecated use UriLabelService instead + * @deprecated use LabelService instead */ export function getPathLabel(resource: URI | string, userHomeProvider: IUserHomeProvider, rootProvider?: IWorkspaceFolderProvider): string { if (!resource) { diff --git a/src/vs/code/electron-main/app.ts b/src/vs/code/electron-main/app.ts index d68fb99ae68..c783bbd281d 100644 --- a/src/vs/code/electron-main/app.ts +++ b/src/vs/code/electron-main/app.ts @@ -63,7 +63,7 @@ import { serve as serveDriver } from 'vs/platform/driver/electron-main/driver'; import { IMenubarService } from 'vs/platform/menubar/common/menubar'; import { MenubarService } from 'vs/platform/menubar/electron-main/menubarService'; import { MenubarChannel } from 'vs/platform/menubar/node/menubarIpc'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; import { CodeMenu } from 'vs/code/electron-main/menus'; import { hasArgs } from 'vs/platform/environment/node/argv'; import { RunOnceScheduler } from 'vs/base/common/async'; @@ -90,7 +90,7 @@ export class CodeApplication { @IConfigurationService private configurationService: ConfigurationService, @IStateService private stateService: IStateService, @IHistoryMainService private historyMainService: IHistoryMainService, - @IUriLabelService private uriLabelService: IUriLabelService + @ILabelService private labelService: ILabelService ) { this.toDispose = [mainIpcServer, configurationService]; @@ -228,8 +228,8 @@ export class CodeApplication { } }); - ipc.on('vscode:uriLabelRegisterFormater', (event: any, { scheme, formater }) => { - this.uriLabelService.registerFormater(scheme, formater); + ipc.on('vscode:labelRegisterFormater', (event: any, { scheme, formater }) => { + this.labelService.registerFormater(scheme, formater); }); // Keyboard layout changes diff --git a/src/vs/code/electron-main/main.ts b/src/vs/code/electron-main/main.ts index 3c2c255e3f7..683164272f8 100644 --- a/src/vs/code/electron-main/main.ts +++ b/src/vs/code/electron-main/main.ts @@ -50,7 +50,7 @@ import { uploadLogs } from 'vs/code/electron-main/logUploader'; import { setUnexpectedErrorHandler } from 'vs/base/common/errors'; import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; import { CommandLineDialogService } from 'vs/platform/dialogs/node/dialogService'; -import { IUriLabelService, UriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService, LabelService } from 'vs/platform/label/common/label'; function createServices(args: ParsedArgs, bufferLogService: BufferLogService): IInstantiationService { const services = new ServiceCollection(); @@ -58,7 +58,7 @@ function createServices(args: ParsedArgs, bufferLogService: BufferLogService): I const environmentService = new EnvironmentService(args, process.execPath); const consoleLogService = new ConsoleLogMainService(getLogLevel(environmentService)); const logService = new MultiplexLogService([consoleLogService, bufferLogService]); - const uriLabelService = new UriLabelService(environmentService, undefined); + const labelService = new LabelService(environmentService, undefined); process.once('exit', () => logService.dispose()); @@ -66,7 +66,7 @@ function createServices(args: ParsedArgs, bufferLogService: BufferLogService): I setTimeout(() => cleanupOlderLogs(environmentService).then(null, err => console.error(err)), 10000); services.set(IEnvironmentService, environmentService); - services.set(IUriLabelService, uriLabelService); + services.set(ILabelService, labelService); services.set(ILogService, logService); services.set(IWorkspacesMainService, new SyncDescriptor(WorkspacesMainService)); services.set(IHistoryMainService, new SyncDescriptor(HistoryMainService)); diff --git a/src/vs/code/electron-main/menubar.ts b/src/vs/code/electron-main/menubar.ts index 9aca1cca19f..1e883015480 100644 --- a/src/vs/code/electron-main/menubar.ts +++ b/src/vs/code/electron-main/menubar.ts @@ -22,7 +22,7 @@ import { IHistoryMainService } from 'vs/platform/history/common/history'; import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces'; import { IMenubarData, IMenubarKeybinding, MenubarMenuItem, isMenubarMenuItemSeparator, isMenubarMenuItemSubmenu, isMenubarMenuItemAction } from 'vs/platform/menubar/common/menubar'; import URI from 'vs/base/common/uri'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; const telemetryFrom = 'menu'; @@ -49,7 +49,7 @@ export class Menubar { @IEnvironmentService private environmentService: IEnvironmentService, @ITelemetryService private telemetryService: ITelemetryService, @IHistoryMainService private historyMainService: IHistoryMainService, - @IUriLabelService private uriLabelService: IUriLabelService + @ILabelService private labelService: ILabelService ) { this.menuUpdater = new RunOnceScheduler(() => this.doUpdateMenu(), 0); @@ -563,13 +563,13 @@ export class Menubar { let label: string; let uri: URI; if (isSingleFolderWorkspaceIdentifier(workspaceOrFile) && !isFile) { - label = unmnemonicLabel(this.uriLabelService.getWorkspaceLabel(workspaceOrFile, { verbose: true })); + label = unmnemonicLabel(this.labelService.getWorkspaceLabel(workspaceOrFile, { verbose: true })); uri = workspaceOrFile; } else if (isWorkspaceIdentifier(workspaceOrFile)) { - label = this.uriLabelService.getWorkspaceLabel(workspaceOrFile, { verbose: true }); + label = this.labelService.getWorkspaceLabel(workspaceOrFile, { verbose: true }); uri = URI.file(workspaceOrFile.configPath); } else { - label = unmnemonicLabel(this.uriLabelService.getLabel(workspaceOrFile)); + label = unmnemonicLabel(this.labelService.getUriLabel(workspaceOrFile)); uri = workspaceOrFile; } diff --git a/src/vs/code/electron-main/menus.ts b/src/vs/code/electron-main/menus.ts index 3a27ba9c4d8..118192b01b4 100644 --- a/src/vs/code/electron-main/menus.ts +++ b/src/vs/code/electron-main/menus.ts @@ -24,7 +24,7 @@ import { IWindowsMainService, IWindowsCountChangedEvent } from 'vs/platform/wind import { IHistoryMainService } from 'vs/platform/history/common/history'; import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces'; import URI from 'vs/base/common/uri'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; interface IMenuItemClickHandler { inDevTools: (contents: Electron.WebContents) => void; @@ -68,7 +68,7 @@ export class CodeMenu { @IEnvironmentService private environmentService: IEnvironmentService, @ITelemetryService private telemetryService: ITelemetryService, @IHistoryMainService private historyMainService: IHistoryMainService, - @IUriLabelService private uriLabelService: IUriLabelService + @ILabelService private labelService: ILabelService ) { this.nativeTabMenuItems = []; @@ -491,14 +491,14 @@ export class CodeMenu { let label: string; let uri: URI; if (isSingleFolderWorkspaceIdentifier(workspace)) { - label = unmnemonicLabel(this.uriLabelService.getWorkspaceLabel(workspace, { verbose: true })); + label = unmnemonicLabel(this.labelService.getWorkspaceLabel(workspace, { verbose: true })); uri = workspace; } else if (isWorkspaceIdentifier(workspace)) { - label = this.uriLabelService.getWorkspaceLabel(workspace, { verbose: true }); + label = this.labelService.getWorkspaceLabel(workspace, { verbose: true }); uri = URI.file(workspace.configPath); } else { uri = URI.file(workspace); - label = unmnemonicLabel(this.uriLabelService.getLabel(uri)); + label = unmnemonicLabel(this.labelService.getUriLabel(uri)); } return new MenuItem(this.likeAction(commandId, { diff --git a/src/vs/editor/contrib/referenceSearch/referencesWidget.ts b/src/vs/editor/contrib/referenceSearch/referencesWidget.ts index da6bf29eb68..ce56fc0822e 100644 --- a/src/vs/editor/contrib/referenceSearch/referencesWidget.ts +++ b/src/vs/editor/contrib/referenceSearch/referencesWidget.ts @@ -40,7 +40,7 @@ import { WorkbenchTree, WorkbenchTreeController } from 'vs/platform/list/browser import { RawContextKey } from 'vs/platform/contextkey/common/contextkey'; import { Location } from 'vs/editor/common/modes'; import { ClickBehavior } from 'vs/base/parts/tree/browser/treeDefaults'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; import { dirname, basenameOrAuthority } from 'vs/base/common/resources'; import { getBaseLabel } from 'vs/base/common/labels'; @@ -300,7 +300,7 @@ class FileReferencesTemplate { constructor( container: HTMLElement, - @IUriLabelService private readonly _uriLabel: IUriLabelService, + @ILabelService private readonly _uriLabel: ILabelService, @IThemeService themeService: IThemeService, ) { const parent = document.createElement('div'); @@ -319,7 +319,7 @@ class FileReferencesTemplate { set(element: FileReferences) { let parent = dirname(element.uri); - this.file.setValue(getBaseLabel(element.uri), parent ? this._uriLabel.getLabel(parent, true) : undefined, { title: this._uriLabel.getLabel(element.uri) }); + this.file.setValue(getBaseLabel(element.uri), parent ? this._uriLabel.getUriLabel(parent, true) : undefined, { title: this._uriLabel.getUriLabel(element.uri) }); const len = element.children.length; this.badge.setCount(len); if (element.failure) { @@ -368,7 +368,7 @@ class Renderer implements tree.IRenderer { constructor( @IThemeService private readonly _themeService: IThemeService, - @IUriLabelService private readonly _uriLabel: IUriLabelService, + @ILabelService private readonly _uriLabel: ILabelService, ) { // } @@ -532,7 +532,7 @@ export class ReferenceWidget extends PeekViewWidget { @IThemeService themeService: IThemeService, @ITextModelService private _textModelResolverService: ITextModelService, @IInstantiationService private _instantiationService: IInstantiationService, - @IUriLabelService private _uriLabel: IUriLabelService + @ILabelService private _uriLabel: ILabelService ) { super(editor, { showFrame: false, showArrow: true, isResizeable: true, isAccessible: true }); @@ -778,7 +778,7 @@ export class ReferenceWidget extends PeekViewWidget { // Update widget header if (reference.uri.scheme !== Schemas.inMemory) { - this.setTitle(basenameOrAuthority(reference.uri), this._uriLabel.getLabel(dirname(reference.uri), false)); + this.setTitle(basenameOrAuthority(reference.uri), this._uriLabel.getUriLabel(dirname(reference.uri), false)); } else { this.setTitle(nls.localize('peekView.alternateTitle', "References")); } diff --git a/src/vs/editor/standalone/browser/simpleServices.ts b/src/vs/editor/standalone/browser/simpleServices.ts index 2bd024ca87d..fc453105c2c 100644 --- a/src/vs/editor/standalone/browser/simpleServices.ts +++ b/src/vs/editor/standalone/browser/simpleServices.ts @@ -45,7 +45,7 @@ import { WorkspaceEdit, isResourceTextEdit, TextEdit } from 'vs/editor/common/mo import { IModelService } from 'vs/editor/common/services/modelService'; import { EditOperation } from 'vs/editor/common/core/editOperation'; import { localize } from 'vs/nls'; -import { IUriLabelService, UriLabelRules } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService, UriLabelRules } from 'vs/platform/label/common/label'; export class SimpleModel implements ITextEditorModel { @@ -596,13 +596,13 @@ export class SimpleBulkEditService implements IBulkEditService { } } -export class SimpleUriLabelService implements IUriLabelService { +export class SimpleUriLabelService implements ILabelService { _serviceBrand: any; private readonly _onDidRegisterFormater: Emitter<{ scheme: string, formater: UriLabelRules }> = new Emitter<{ scheme: string, formater: UriLabelRules }>(); public readonly onDidRegisterFormater: Event<{ scheme: string, formater: UriLabelRules }> = this._onDidRegisterFormater.event; - public getLabel(resource: URI, relative?: boolean): string { + public getUriLabel(resource: URI, relative?: boolean): string { if (resource.scheme === 'file') { return resource.fsPath; } diff --git a/src/vs/editor/standalone/browser/standaloneServices.ts b/src/vs/editor/standalone/browser/standaloneServices.ts index d20dc25b60e..c6ca31a3c08 100644 --- a/src/vs/editor/standalone/browser/standaloneServices.ts +++ b/src/vs/editor/standalone/browser/standaloneServices.ts @@ -44,7 +44,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; import { IListService, ListService } from 'vs/platform/list/browser/listService'; import { IBulkEditService } from 'vs/editor/browser/services/bulkEditService'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; export interface IEditorOverrideServices { [index: string]: any; @@ -122,7 +122,7 @@ export module StaticServices { export const contextService = define(IWorkspaceContextService, () => new SimpleWorkspaceContextService()); - export const uriLabelService = define(IUriLabelService, () => new SimpleUriLabelService()); + export const labelService = define(ILabelService, () => new SimpleUriLabelService()); export const telemetryService = define(ITelemetryService, () => new StandaloneTelemetryService()); diff --git a/src/vs/platform/history/electron-main/historyMainService.ts b/src/vs/platform/history/electron-main/historyMainService.ts index aaaeca45452..a3defec9a9a 100644 --- a/src/vs/platform/history/electron-main/historyMainService.ts +++ b/src/vs/platform/history/electron-main/historyMainService.ts @@ -21,7 +21,7 @@ import { RunOnceScheduler } from 'vs/base/common/async'; import { getComparisonKey, isEqual as areResourcesEqual, dirname } from 'vs/base/common/resources'; import URI, { UriComponents } from 'vs/base/common/uri'; import { Schemas } from 'vs/base/common/network'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; interface ISerializedRecentlyOpened { workspaces2: (IWorkspaceIdentifier | string)[]; // IWorkspaceIdentifier or URI.toString() @@ -51,7 +51,7 @@ export class HistoryMainService implements IHistoryMainService { @IStateService private stateService: IStateService, @ILogService private logService: ILogService, @IWorkspacesMainService private workspacesMainService: IWorkspacesMainService, - @IUriLabelService private uriLabelService: IUriLabelService + @ILabelService private labelService: ILabelService ) { this.macOSRecentDocumentsUpdater = new RunOnceScheduler(() => this.updateMacOSRecentDocuments(), 800); @@ -366,11 +366,11 @@ export class HistoryMainService implements IHistoryMainService { type: 'custom', name: nls.localize('recentFolders', "Recent Workspaces"), items: this.getRecentlyOpened().workspaces.slice(0, 7 /* limit number of entries here */).map(workspace => { - const title = this.uriLabelService.getWorkspaceLabel(workspace); + const title = this.labelService.getWorkspaceLabel(workspace); let description; let args; if (isSingleFolderWorkspaceIdentifier(workspace)) { - description = nls.localize('folderDesc', "{0} {1}", getBaseLabel(workspace), this.uriLabelService.getLabel(dirname(workspace))); + description = nls.localize('folderDesc', "{0} {1}", getBaseLabel(workspace), this.labelService.getUriLabel(dirname(workspace))); args = `--folder-uri "${workspace.toString()}"`; } else { description = nls.localize('codeWorkspace', "Code Workspace"); diff --git a/src/vs/platform/uriLabel/common/uriLabel.ts b/src/vs/platform/label/common/label.ts similarity index 91% rename from src/vs/platform/uriLabel/common/uriLabel.ts rename to src/vs/platform/label/common/label.ts index 1212469e636..1348437a295 100644 --- a/src/vs/platform/uriLabel/common/uriLabel.ts +++ b/src/vs/platform/label/common/label.ts @@ -18,9 +18,9 @@ import { localize } from 'vs/nls'; import { isParent } from 'vs/platform/files/common/files'; import { basename, dirname, join } from 'vs/base/common/paths'; -export interface IUriLabelService { +export interface ILabelService { _serviceBrand: any; - getLabel(resource: URI, relative?: boolean, forceNoTildify?: boolean): string; + getUriLabel(resource: URI, relative?: boolean, forceNoTildify?: boolean): string; getWorkspaceLabel(workspace: (IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | IWorkspace), options?: { verbose: boolean }): string; registerFormater(schema: string, formater: UriLabelRules): IDisposable; onDidRegisterFormater: Event<{ scheme: string, formater: UriLabelRules }>; @@ -33,7 +33,7 @@ export interface UriLabelRules { normalizeDriveLetter?: boolean; } -const URI_LABEL_SERVICE_ID = 'uriLabel'; +const LABEL_SERVICE_ID = 'label'; const sepRegexp = /\//g; const labelMatchingRegexp = /\$\{scheme\}|\$\{authority\}|\$\{path\}/g; @@ -41,7 +41,7 @@ function hasDriveLetter(path: string): boolean { return isWindows && path && path[2] === ':'; } -export class UriLabelService implements IUriLabelService { +export class LabelService implements ILabelService { _serviceBrand: any; private readonly formaters = new Map(); @@ -56,7 +56,7 @@ export class UriLabelService implements IUriLabelService { return this._onDidRegisterFormater.event; } - getLabel(resource: URI, relative?: boolean, forceNoTildify?: boolean): string { + getUriLabel(resource: URI, relative?: boolean, forceNoTildify?: boolean): string { if (!resource) { return undefined; } @@ -100,7 +100,7 @@ export class UriLabelService implements IUriLabelService { // Workspace: Single Folder if (isSingleFolderWorkspaceIdentifier(workspace)) { // Folder on disk - return options && options.verbose ? this.getLabel(workspace) : basenameOrAuthority(workspace); + return options && options.verbose ? this.getUriLabel(workspace) : basenameOrAuthority(workspace); } // Workspace: Untitled @@ -112,7 +112,7 @@ export class UriLabelService implements IUriLabelService { const filename = basename(workspace.configPath); const workspaceName = filename.substr(0, filename.length - WORKSPACE_EXTENSION.length - 1); if (options && options.verbose) { - return localize('workspaceNameVerbose', "{0} (Workspace)", this.getLabel(URI.file(join(dirname(workspace.configPath), workspaceName)))); + return localize('workspaceNameVerbose', "{0} (Workspace)", this.getUriLabel(URI.file(join(dirname(workspace.configPath), workspaceName)))); } return localize('workspaceName', "{0} (Workspace)", workspaceName); @@ -150,4 +150,4 @@ export class UriLabelService implements IUriLabelService { } } -export const IUriLabelService = createDecorator(URI_LABEL_SERVICE_ID); +export const ILabelService = createDecorator(LABEL_SERVICE_ID); diff --git a/src/vs/platform/uriLabel/electron-browser/uriLabel.contribution.ts b/src/vs/platform/label/electron-browser/label.contribution.ts similarity index 68% rename from src/vs/platform/uriLabel/electron-browser/uriLabel.contribution.ts rename to src/vs/platform/label/electron-browser/label.contribution.ts index bbd24220002..f3b6c6ba189 100644 --- a/src/vs/platform/uriLabel/electron-browser/uriLabel.contribution.ts +++ b/src/vs/platform/label/electron-browser/label.contribution.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; import { ipcRenderer as ipc } from 'electron'; import { Registry } from 'vs/platform/registry/common/platform'; import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; @@ -13,13 +13,13 @@ import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; * Uri display registration needs to be shared from renderer to main. * Since there will be another instance of the uri display service running on main. */ -class UriLabelRegistrationContribution implements IWorkbenchContribution { +class LabelRegistrationContribution implements IWorkbenchContribution { - constructor(@IUriLabelService uriLabelService: IUriLabelService) { - uriLabelService.onDidRegisterFormater(data => { - ipc.send('vscode:uriLabelRegisterFormater', data); + constructor(@ILabelService labelService: ILabelService) { + labelService.onDidRegisterFormater(data => { + ipc.send('vscode:labelRegisterFormater', data); }); } } -Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(UriLabelRegistrationContribution, LifecyclePhase.Starting); +Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(LabelRegistrationContribution, LifecyclePhase.Starting); diff --git a/src/vs/platform/uriLabel/test/uriLabel.test.ts b/src/vs/platform/label/test/uriLabel.test.ts similarity index 72% rename from src/vs/platform/uriLabel/test/uriLabel.test.ts rename to src/vs/platform/label/test/uriLabel.test.ts index 6efc8d528e9..f1d9f85b72a 100644 --- a/src/vs/platform/uriLabel/test/uriLabel.test.ts +++ b/src/vs/platform/label/test/uriLabel.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; -import { UriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { LabelService } from 'vs/platform/label/common/label'; import { TestEnvironmentService, TestContextService } from 'vs/workbench/test/workbenchTestServices'; import { Schemas } from 'vs/base/common/network'; import { TestWorkspace } from 'vs/platform/workspace/test/common/testWorkspace'; @@ -14,14 +14,14 @@ import { isWindows } from 'vs/base/common/platform'; suite('URI Label', () => { - let uriLabelService: UriLabelService; + let labelService: LabelService; setup(() => { - uriLabelService = new UriLabelService(TestEnvironmentService, new TestContextService()); + labelService = new LabelService(TestEnvironmentService, new TestContextService()); }); test('file scheme', function () { - uriLabelService.registerFormater(Schemas.file, { + labelService.registerFormater(Schemas.file, { label: '${path}', separator: nativeSep, tildify: !isWindows, @@ -29,15 +29,15 @@ suite('URI Label', () => { }); const uri1 = TestWorkspace.folders[0].uri.with({ path: TestWorkspace.folders[0].uri.path.concat('/a/b/c/d') }); - assert.equal(uriLabelService.getLabel(uri1, true), isWindows ? 'a\\b\\c\\d' : 'a/b/c/d'); - assert.equal(uriLabelService.getLabel(uri1, false), isWindows ? 'C:\\testWorkspace\\a\\b\\c\\d' : '/testWorkspace/a/b/c/d'); + assert.equal(labelService.getUriLabel(uri1, true), isWindows ? 'a\\b\\c\\d' : 'a/b/c/d'); + assert.equal(labelService.getUriLabel(uri1, false), isWindows ? 'C:\\testWorkspace\\a\\b\\c\\d' : '/testWorkspace/a/b/c/d'); const uri2 = URI.file('c:\\1/2/3'); - assert.equal(uriLabelService.getLabel(uri2, false), isWindows ? 'C:\\1\\2\\3' : '/c:\\1/2/3'); + assert.equal(labelService.getUriLabel(uri2, false), isWindows ? 'C:\\1\\2\\3' : '/c:\\1/2/3'); }); test('custom scheme', function () { - uriLabelService.registerFormater(Schemas.vscode, { + labelService.registerFormater(Schemas.vscode, { label: 'LABEL/${path}/${authority}/END', separator: '/', tildify: true, @@ -45,6 +45,6 @@ suite('URI Label', () => { }); const uri1 = URI.parse('vscode://microsoft.com/1/2/3/4/5'); - assert.equal(uriLabelService.getLabel(uri1, false), 'LABEL//1/2/3/4/5/microsoft.com/END'); + assert.equal(labelService.getUriLabel(uri1, false), 'LABEL//1/2/3/4/5/microsoft.com/END'); }); }); diff --git a/src/vs/workbench/api/electron-browser/mainThreadFileSystem.ts b/src/vs/workbench/api/electron-browser/mainThreadFileSystem.ts index 164d458a3ed..b448699381b 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadFileSystem.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadFileSystem.ts @@ -11,7 +11,7 @@ import { TPromise } from 'vs/base/common/winjs.base'; import { FileWriteOptions, FileSystemProviderCapabilities, IFileChange, IFileService, IFileSystemProvider, IStat, IWatchOptions, FileType, FileOverwriteOptions, FileDeleteOptions } from 'vs/platform/files/common/files'; import { extHostNamedCustomer } from 'vs/workbench/api/electron-browser/extHostCustomers'; import { ExtHostContext, ExtHostFileSystemShape, IExtHostContext, IFileChangeDto, MainContext, MainThreadFileSystemShape } from '../node/extHost.protocol'; -import { UriLabelRules, IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { UriLabelRules, ILabelService } from 'vs/platform/label/common/label'; @extHostNamedCustomer(MainContext.MainThreadFileSystem) export class MainThreadFileSystem implements MainThreadFileSystemShape { @@ -22,7 +22,7 @@ export class MainThreadFileSystem implements MainThreadFileSystemShape { constructor( extHostContext: IExtHostContext, @IFileService private readonly _fileService: IFileService, - @IUriLabelService private readonly _uriLabelService: IUriLabelService + @ILabelService private readonly _labelService: ILabelService ) { this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostFileSystem); } @@ -42,7 +42,7 @@ export class MainThreadFileSystem implements MainThreadFileSystemShape { } $setUriFormatter(scheme: string, formatter: UriLabelRules): void { - this._uriLabelService.registerFormater(scheme, formatter); + this._labelService.registerFormater(scheme, formatter); } $onFileSystemChange(handle: number, changes: IFileChangeDto[]): void { diff --git a/src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts b/src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts index 03f782d04e2..4f072168bc2 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts @@ -23,7 +23,7 @@ import { CommandsRegistry } from 'vs/platform/commands/common/commands'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil'; import { IWindowService } from 'vs/platform/windows/common/windows'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; @extHostNamedCustomer(MainContext.MainThreadWorkspace) export class MainThreadWorkspace implements MainThreadWorkspaceShape { @@ -41,7 +41,7 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape { @IWorkspaceEditingService private readonly _workspaceEditingService: IWorkspaceEditingService, @IStatusbarService private readonly _statusbarService: IStatusbarService, @IInstantiationService private readonly _instantiationService: IInstantiationService, - @IUriLabelService private readonly _uriLabelService: IUriLabelService + @ILabelService private readonly _labelService: ILabelService ) { this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostWorkspace); this._contextService.onDidChangeWorkspaceFolders(this._onDidChangeWorkspace, this, this._toDispose); @@ -106,7 +106,7 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape { configuration: workspace.configuration, folders: workspace.folders, id: workspace.id, - name: this._uriLabelService.getWorkspaceLabel(workspace) + name: this._labelService.getWorkspaceLabel(workspace) } : null); } diff --git a/src/vs/workbench/api/node/extHost.protocol.ts b/src/vs/workbench/api/node/extHost.protocol.ts index edb764542ad..d4dd60c6d53 100644 --- a/src/vs/workbench/api/node/extHost.protocol.ts +++ b/src/vs/workbench/api/node/extHost.protocol.ts @@ -40,7 +40,7 @@ import { IExtensionDescription } from 'vs/workbench/services/extensions/common/e import { createExtHostContextProxyIdentifier as createExtId, createMainContextProxyIdentifier as createMainId, IRPCProtocol, ProxyIdentifier } from 'vs/workbench/services/extensions/node/proxyIdentifier'; import { IProgressOptions, IProgressStep } from 'vs/workbench/services/progress/common/progress'; import { SaveReason } from 'vs/workbench/services/textfile/common/textfiles'; -import { UriLabelRules } from 'vs/platform/uriLabel/common/uriLabel'; +import { UriLabelRules } from 'vs/platform/label/common/label'; import * as vscode from 'vscode'; export interface IEnvironment { diff --git a/src/vs/workbench/api/node/extHostFileSystem.ts b/src/vs/workbench/api/node/extHostFileSystem.ts index 732d21cd761..74f9610976f 100644 --- a/src/vs/workbench/api/node/extHostFileSystem.ts +++ b/src/vs/workbench/api/node/extHostFileSystem.ts @@ -15,7 +15,7 @@ import { values } from 'vs/base/common/map'; import { Range, FileChangeType } from 'vs/workbench/api/node/extHostTypes'; import { ExtHostLanguageFeatures } from 'vs/workbench/api/node/extHostLanguageFeatures'; import { Schemas } from 'vs/base/common/network'; -import { UriLabelRules } from 'vs/platform/uriLabel/common/uriLabel'; +import { UriLabelRules } from 'vs/platform/label/common/label'; class FsLinkProvider implements vscode.DocumentLinkProvider { diff --git a/src/vs/workbench/browser/actions/workspaceCommands.ts b/src/vs/workbench/browser/actions/workspaceCommands.ts index 055f30bd49d..20cb58d1da7 100644 --- a/src/vs/workbench/browser/actions/workspaceCommands.ts +++ b/src/vs/workbench/browser/actions/workspaceCommands.ts @@ -22,7 +22,7 @@ import { FileKind, isParent } from 'vs/platform/files/common/files'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { isLinux } from 'vs/base/common/platform'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; import { IQuickInputService, IPickOptions, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput'; import { getIconClasses } from 'vs/workbench/browser/labels'; import { IModelService } from 'vs/editor/common/services/modelService'; @@ -163,7 +163,7 @@ CommandsRegistry.registerCommand({ CommandsRegistry.registerCommand(PICK_WORKSPACE_FOLDER_COMMAND_ID, function (accessor, args?: [IPickOptions, CancellationToken]) { const quickInputService = accessor.get(IQuickInputService); - const uriLabelService = accessor.get(IUriLabelService); + const labelService = accessor.get(ILabelService); const contextService = accessor.get(IWorkspaceContextService); const modelService = accessor.get(IModelService); const modeService = accessor.get(IModeService); @@ -176,7 +176,7 @@ CommandsRegistry.registerCommand(PICK_WORKSPACE_FOLDER_COMMAND_ID, function (acc const folderPicks = folders.map(folder => { return { label: folder.name, - description: uriLabelService.getLabel(resources.dirname(folder.uri), true), + description: labelService.getUriLabel(resources.dirname(folder.uri), true), folder, iconClasses: getIconClasses(modelService, modeService, folder.uri, FileKind.ROOT_FOLDER) } as IQuickPickItem; diff --git a/src/vs/workbench/browser/labels.ts b/src/vs/workbench/browser/labels.ts index 7a1b6e0aedc..fa7213df83f 100644 --- a/src/vs/workbench/browser/labels.ts +++ b/src/vs/workbench/browser/labels.ts @@ -23,7 +23,7 @@ import { ITextModel } from 'vs/editor/common/model'; import { IThemeService } from 'vs/platform/theme/common/themeService'; import { Event, Emitter } from 'vs/base/common/event'; import { DataUri } from 'vs/workbench/common/resources'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; export interface IResourceLabel { name: string; @@ -56,7 +56,7 @@ export class ResourceLabel extends IconLabel { @IModelService private modelService: IModelService, @IDecorationsService protected decorationsService: IDecorationsService, @IThemeService private themeService: IThemeService, - @IUriLabelService protected uriLabelService: IUriLabelService + @ILabelService protected labelService: ILabelService ) { super(container, options); @@ -191,7 +191,7 @@ export class ResourceLabel extends IconLabel { iconLabelOptions.title = this.options.title; } else if (resource && resource.scheme !== Schemas.data /* do not accidentally inline Data URIs */) { if (!this.computedPathLabel) { - this.computedPathLabel = this.uriLabelService.getLabel(resource); + this.computedPathLabel = this.labelService.getUriLabel(resource); } iconLabelOptions.title = this.computedPathLabel; @@ -274,9 +274,9 @@ export class FileLabel extends ResourceLabel { @IDecorationsService decorationsService: IDecorationsService, @IThemeService themeService: IThemeService, @IUntitledEditorService private untitledEditorService: IUntitledEditorService, - @IUriLabelService uriLabelService: IUriLabelService + @ILabelService labelService: ILabelService ) { - super(container, options, extensionService, configurationService, modeService, modelService, decorationsService, themeService, uriLabelService); + super(container, options, extensionService, configurationService, modeService, modelService, decorationsService, themeService, labelService); } setFile(resource: uri, options?: IFileLabelOptions): void { @@ -298,7 +298,7 @@ export class FileLabel extends ResourceLabel { let description: string; const hidePath = (options && options.hidePath) || (resource.scheme === Schemas.untitled && !this.untitledEditorService.hasAssociatedFilePath(resource)); if (!hidePath) { - description = this.uriLabelService.getLabel(resources.dirname(resource), true); + description = this.labelService.getUriLabel(resources.dirname(resource), true); } this.setLabel({ resource, name, description }, options); diff --git a/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts b/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts index 428a391e24b..279febbdff1 100644 --- a/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts +++ b/src/vs/workbench/browser/parts/quickopen/quickOpenController.ts @@ -49,7 +49,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati import { Dimension, addClass } from 'vs/base/browser/dom'; import { IEditorService, ACTIVE_GROUP, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService'; import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; import { timeout } from 'vs/base/common/async'; import { IQuickInputService, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput'; @@ -684,7 +684,7 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry { @IModelService private modelService: IModelService, @ITextFileService private textFileService: ITextFileService, @IConfigurationService private configurationService: IConfigurationService, - @IUriLabelService uriLabelService: IUriLabelService, + @ILabelService labelService: ILabelService, @IFileService fileService: IFileService ) { super(editorService); @@ -700,7 +700,7 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry { const resourceInput = input as IResourceInput; this.resource = resourceInput.resource; this.label = resources.basenameOrAuthority(resourceInput.resource); - this.description = uriLabelService.getLabel(resources.dirname(this.resource), true); + this.description = labelService.getUriLabel(resources.dirname(this.resource), true); this.dirty = this.resource && this.textFileService.isDirty(this.resource); if (this.dirty && this.textFileService.getAutoSaveMode() === AutoSaveMode.AFTER_SHORT_DELAY) { diff --git a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts index 676e4ab348a..dbcb3c29de4 100644 --- a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts +++ b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts @@ -29,7 +29,7 @@ import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier, isSingleFolderW import { RunOnceScheduler } from 'vs/base/common/async'; import { MENUBAR_SELECTION_FOREGROUND, MENUBAR_SELECTION_BACKGROUND, MENUBAR_SELECTION_BORDER, TITLE_BAR_ACTIVE_FOREGROUND, TITLE_BAR_INACTIVE_FOREGROUND, MENU_BACKGROUND, MENU_FOREGROUND, MENU_SELECTION_BACKGROUND, MENU_SELECTION_FOREGROUND, MENU_SELECTION_BORDER } from 'vs/workbench/common/theme'; import URI from 'vs/base/common/uri'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; import { foreground } from 'vs/platform/theme/common/colorRegistry'; import { IUpdateService, StateType } from 'vs/platform/update/common/update'; @@ -121,7 +121,7 @@ export class MenubarControl extends Disposable { @IContextKeyService private contextKeyService: IContextKeyService, @IKeybindingService private keybindingService: IKeybindingService, @IConfigurationService private configurationService: IConfigurationService, - @IUriLabelService private uriLabelService: IUriLabelService, + @ILabelService private labelService: ILabelService, @IUpdateService private updateService: IUpdateService ) { @@ -531,14 +531,14 @@ export class MenubarControl extends Disposable { let uri: URI; if (isSingleFolderWorkspaceIdentifier(workspace) && !isFile) { - label = this.uriLabelService.getWorkspaceLabel(workspace, { verbose: true }); + label = this.labelService.getWorkspaceLabel(workspace, { verbose: true }); uri = workspace; } else if (isWorkspaceIdentifier(workspace)) { - label = this.uriLabelService.getWorkspaceLabel(workspace, { verbose: true }); + label = this.labelService.getWorkspaceLabel(workspace, { verbose: true }); uri = URI.file(workspace.configPath); } else { uri = workspace; - label = this.uriLabelService.getLabel(uri); + label = this.labelService.getUriLabel(uri); } return new Action(commandId, label, undefined, undefined, (event) => { diff --git a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts index 597f47f2881..dffc7b7dcdf 100644 --- a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts +++ b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts @@ -34,7 +34,7 @@ import { addDisposableListener, EventType, EventHelper, Dimension } from 'vs/bas import { MenubarControl } from 'vs/workbench/browser/parts/titlebar/menubarControl'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { template, getBaseLabel } from 'vs/base/common/labels'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; import { Event } from 'vs/base/common/event'; export class TitlebarPart extends Part implements ITitleService { @@ -84,7 +84,7 @@ export class TitlebarPart extends Part implements ITitleService { @IWorkspaceContextService private contextService: IWorkspaceContextService, @IInstantiationService private instantiationService: IInstantiationService, @IThemeService themeService: IThemeService, - @IUriLabelService private uriLabelService: IUriLabelService + @ILabelService private labelService: ILabelService ) { super(id, { hasTitle: false }, themeService); @@ -243,10 +243,10 @@ export class TitlebarPart extends Part implements ITitleService { const activeEditorShort = editor ? editor.getTitle(Verbosity.SHORT) : ''; const activeEditorMedium = editor ? editor.getTitle(Verbosity.MEDIUM) : activeEditorShort; const activeEditorLong = editor ? editor.getTitle(Verbosity.LONG) : activeEditorMedium; - const rootName = root ? this.uriLabelService.getWorkspaceLabel(root) : ''; - const rootPath = root ? this.uriLabelService.getLabel(root) : ''; + const rootName = root ? this.labelService.getWorkspaceLabel(root) : ''; + const rootPath = root ? this.labelService.getUriLabel(root) : ''; const folderName = folder ? folder.name : ''; - const folderPath = folder ? this.uriLabelService.getLabel(folder.uri) : ''; + const folderPath = folder ? this.labelService.getUriLabel(folder.uri) : ''; const dirty = editor && editor.isDirty() ? TitlebarPart.TITLE_DIRTY : ''; const appName = this.environmentService.appNameLong; const separator = TitlebarPart.TITLE_SEPARATOR; diff --git a/src/vs/workbench/common/editor/untitledEditorInput.ts b/src/vs/workbench/common/editor/untitledEditorInput.ts index 93d3f05fdec..cdd5ab7c14d 100644 --- a/src/vs/workbench/common/editor/untitledEditorInput.ts +++ b/src/vs/workbench/common/editor/untitledEditorInput.ts @@ -18,7 +18,7 @@ import { Event, Emitter } from 'vs/base/common/event'; import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; import { telemetryURIDescriptor } from 'vs/platform/telemetry/common/telemetryUtils'; import { IHashService } from 'vs/workbench/services/hash/common/hashService'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; /** * An editor input to be used for untitled text buffers. @@ -46,7 +46,7 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport @IInstantiationService private instantiationService: IInstantiationService, @ITextFileService private textFileService: ITextFileService, @IHashService private hashService: IHashService, - @IUriLabelService private uriLabelService: IUriLabelService + @ILabelService private labelService: ILabelService ) { super(); @@ -79,17 +79,17 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport @memoize private get shortDescription(): string { - return paths.basename(this.uriLabelService.getLabel(resources.dirname(this.resource))); + return paths.basename(this.labelService.getUriLabel(resources.dirname(this.resource))); } @memoize private get mediumDescription(): string { - return this.uriLabelService.getLabel(resources.dirname(this.resource), true); + return this.labelService.getUriLabel(resources.dirname(this.resource), true); } @memoize private get longDescription(): string { - return this.uriLabelService.getLabel(resources.dirname(this.resource)); + return this.labelService.getUriLabel(resources.dirname(this.resource)); } getDescription(verbosity: Verbosity = Verbosity.MEDIUM): string { @@ -121,12 +121,12 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport @memoize private get mediumTitle(): string { - return this.uriLabelService.getLabel(this.resource, true); + return this.labelService.getUriLabel(this.resource, true); } @memoize private get longTitle(): string { - return this.uriLabelService.getLabel(this.resource); + return this.labelService.getUriLabel(this.resource); } getTitle(verbosity: Verbosity): string { diff --git a/src/vs/workbench/electron-browser/actions.ts b/src/vs/workbench/electron-browser/actions.ts index 33500ca8c7e..64f774f9f35 100644 --- a/src/vs/workbench/electron-browser/actions.ts +++ b/src/vs/workbench/electron-browser/actions.ts @@ -40,7 +40,7 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { Context } from 'vs/platform/contextkey/browser/contextKeyService'; import { IWorkbenchIssueService } from 'vs/workbench/services/issue/common/issue'; import { INotificationService } from 'vs/platform/notification/common/notification'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; import { dirname } from 'vs/base/common/resources'; import { IModelService } from 'vs/editor/common/services/modelService'; import { IModeService } from 'vs/editor/common/services/modeService'; @@ -418,7 +418,7 @@ export abstract class BaseOpenRecentAction extends Action { private quickInputService: IQuickInputService, private contextService: IWorkspaceContextService, private environmentService: IEnvironmentService, - private uriLabelService: IUriLabelService, + private labelService: ILabelService, private keybindingService: IKeybindingService, private modelService: IModelService, private modeService: IModeService, @@ -435,22 +435,22 @@ export abstract class BaseOpenRecentAction extends Action { private openRecent(recentWorkspaces: (IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier)[], recentFiles: URI[]): void { - const toPick = (workspace: IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | URI, fileKind: FileKind, environmentService: IEnvironmentService, uriLabelService: IUriLabelService, buttons: IQuickInputButton[]) => { + const toPick = (workspace: IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | URI, fileKind: FileKind, environmentService: IEnvironmentService, labelService: ILabelService, buttons: IQuickInputButton[]) => { let resource: URI; let label: string; let description: string; if (isSingleFolderWorkspaceIdentifier(workspace) && fileKind !== FileKind.FILE) { resource = workspace; - label = uriLabelService.getWorkspaceLabel(workspace); - description = uriLabelService.getLabel(dirname(resource)); + label = labelService.getWorkspaceLabel(workspace); + description = labelService.getUriLabel(dirname(resource)); } else if (isWorkspaceIdentifier(workspace)) { resource = URI.file(workspace.configPath); - label = uriLabelService.getWorkspaceLabel(workspace); - description = uriLabelService.getLabel(dirname(resource)); + label = labelService.getWorkspaceLabel(workspace); + description = labelService.getUriLabel(dirname(resource)); } else { resource = workspace; label = getBaseLabel(workspace); - description = uriLabelService.getLabel(dirname(resource)); + description = labelService.getUriLabel(dirname(resource)); } return { @@ -469,8 +469,8 @@ export abstract class BaseOpenRecentAction extends Action { return this.windowService.openWindow([resource], { forceNewWindow, forceOpenWorkspaceAsFile: isFile }); }; - const workspacePicks = recentWorkspaces.map(workspace => toPick(workspace, isSingleFolderWorkspaceIdentifier(workspace) ? FileKind.FOLDER : FileKind.ROOT_FOLDER, this.environmentService, this.uriLabelService, !this.isQuickNavigate() ? [this.removeFromRecentlyOpened] : void 0)); - const filePicks = recentFiles.map(p => toPick(p, FileKind.FILE, this.environmentService, this.uriLabelService, !this.isQuickNavigate() ? [this.removeFromRecentlyOpened] : void 0)); + const workspacePicks = recentWorkspaces.map(workspace => toPick(workspace, isSingleFolderWorkspaceIdentifier(workspace) ? FileKind.FOLDER : FileKind.ROOT_FOLDER, this.environmentService, this.labelService, !this.isQuickNavigate() ? [this.removeFromRecentlyOpened] : void 0)); + const filePicks = recentFiles.map(p => toPick(p, FileKind.FILE, this.environmentService, this.labelService, !this.isQuickNavigate() ? [this.removeFromRecentlyOpened] : void 0)); // focus second entry if the first recent workspace is the current workspace let autoFocusSecondEntry: boolean = recentWorkspaces[0] && this.contextService.isCurrentWorkspace(recentWorkspaces[0]); @@ -518,9 +518,9 @@ export class OpenRecentAction extends BaseOpenRecentAction { @IKeybindingService keybindingService: IKeybindingService, @IModelService modelService: IModelService, @IModeService modeService: IModeService, - @IUriLabelService uriLabelService: IUriLabelService + @ILabelService labelService: ILabelService ) { - super(id, label, windowService, windowsService, quickInputService, contextService, environmentService, uriLabelService, keybindingService, modelService, modeService); + super(id, label, windowService, windowsService, quickInputService, contextService, environmentService, labelService, keybindingService, modelService, modeService); } protected isQuickNavigate(): boolean { @@ -544,9 +544,9 @@ export class QuickOpenRecentAction extends BaseOpenRecentAction { @IKeybindingService keybindingService: IKeybindingService, @IModelService modelService: IModelService, @IModeService modeService: IModeService, - @IUriLabelService uriLabelService: IUriLabelService + @ILabelService labelService: ILabelService ) { - super(id, label, windowService, windowsService, quickInputService, contextService, environmentService, uriLabelService, keybindingService, modelService, modeService); + super(id, label, windowService, windowsService, quickInputService, contextService, environmentService, labelService, keybindingService, modelService, modeService); } protected isQuickNavigate(): boolean { diff --git a/src/vs/workbench/electron-browser/shell.ts b/src/vs/workbench/electron-browser/shell.ts index 4b366a0299c..b6db73f5201 100644 --- a/src/vs/workbench/electron-browser/shell.ts +++ b/src/vs/workbench/electron-browser/shell.ts @@ -98,7 +98,7 @@ import { ExtensionManagementServerService } from 'vs/workbench/services/extensio import { DownloadServiceChannel } from 'vs/platform/download/node/downloadIpc'; import { DefaultURITransformer } from 'vs/base/common/uriIpc'; import { ExtensionGalleryService } from 'vs/platform/extensionManagement/node/extensionGalleryService'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; /** * Services that we require for the Shell @@ -118,7 +118,7 @@ export interface ICoreServices { export class WorkbenchShell extends Disposable { private storageService: IStorageService; private environmentService: IEnvironmentService; - private uriLabelService: IUriLabelService; + private labelService: ILabelService; private logService: ILogService; private configurationService: IConfigurationService; private contextService: IWorkspaceContextService; @@ -318,7 +318,7 @@ export class WorkbenchShell extends Disposable { serviceCollection.set(IWorkspaceContextService, this.contextService); serviceCollection.set(IConfigurationService, this.configurationService); serviceCollection.set(IEnvironmentService, this.environmentService); - serviceCollection.set(IUriLabelService, this.uriLabelService); + serviceCollection.set(ILabelService, this.labelService); serviceCollection.set(ILogService, this._register(this.logService)); serviceCollection.set(IStorageService, this.storageService); diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts index 851611cc3b3..5b8ee0b77fc 100644 --- a/src/vs/workbench/electron-browser/workbench.ts +++ b/src/vs/workbench/electron-browser/workbench.ts @@ -116,7 +116,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService'; import { WorkbenchThemeService } from 'vs/workbench/services/themes/electron-browser/workbenchThemeService'; import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService'; -import { UriLabelService, IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { LabelService, ILabelService } from 'vs/platform/label/common/label'; interface WorkbenchParams { configuration: IWindowConfiguration; @@ -337,8 +337,8 @@ export class Workbench extends Disposable implements IPartService { serviceCollection.set(IClipboardService, new ClipboardService()); // Uri Display - const uriLabelService = new UriLabelService(this.environmentService, this.contextService); - serviceCollection.set(IUriLabelService, uriLabelService); + const labelService = new LabelService(this.environmentService, this.contextService); + serviceCollection.set(ILabelService, labelService); // Status bar this.statusbarPart = this.instantiationService.createInstance(StatusbarPart, Identifiers.STATUSBAR_PART); diff --git a/src/vs/workbench/parts/debug/browser/breakpointsView.ts b/src/vs/workbench/parts/debug/browser/breakpointsView.ts index 45f200e54b0..dd75a8196d4 100644 --- a/src/vs/workbench/parts/debug/browser/breakpointsView.ts +++ b/src/vs/workbench/parts/debug/browser/breakpointsView.ts @@ -32,7 +32,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; import { IEditorService, SIDE_GROUP, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService'; import { ViewletPanel, IViewletPanelOptions } from 'vs/workbench/browser/parts/views/panelViewlet'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; const $ = dom.$; @@ -296,7 +296,7 @@ class BreakpointsRenderer implements IRenderer element.sourceData; } diff --git a/src/vs/workbench/parts/files/common/editors/fileEditorInput.ts b/src/vs/workbench/parts/files/common/editors/fileEditorInput.ts index 232a677b82c..7954c9cb400 100644 --- a/src/vs/workbench/parts/files/common/editors/fileEditorInput.ts +++ b/src/vs/workbench/parts/files/common/editors/fileEditorInput.ts @@ -21,7 +21,7 @@ import { telemetryURIDescriptor } from 'vs/platform/telemetry/common/telemetryUt import { ITextModelService } from 'vs/editor/common/services/resolverService'; import { IHashService } from 'vs/workbench/services/hash/common/hashService'; import { FILE_EDITOR_INPUT_ID, TEXT_FILE_EDITOR_ID, BINARY_FILE_EDITOR_ID } from 'vs/workbench/parts/files/common/files'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; /** * A file editor input is the input type for the file editor of file system resources. @@ -43,7 +43,7 @@ export class FileEditorInput extends EditorInput implements IFileEditorInput { @ITextFileService private textFileService: ITextFileService, @ITextModelService private textModelResolverService: ITextModelService, @IHashService private hashService: IHashService, - @IUriLabelService private uriLabelService: IUriLabelService + @ILabelService private labelService: ILabelService ) { super(); @@ -132,17 +132,17 @@ export class FileEditorInput extends EditorInput implements IFileEditorInput { @memoize private get shortDescription(): string { - return paths.basename(this.uriLabelService.getLabel(resources.dirname(this.resource))); + return paths.basename(this.labelService.getUriLabel(resources.dirname(this.resource))); } @memoize private get mediumDescription(): string { - return this.uriLabelService.getLabel(resources.dirname(this.resource), true); + return this.labelService.getUriLabel(resources.dirname(this.resource), true); } @memoize private get longDescription(): string { - return this.uriLabelService.getLabel(resources.dirname(this.resource), true); + return this.labelService.getUriLabel(resources.dirname(this.resource), true); } getDescription(verbosity: Verbosity = Verbosity.MEDIUM): string { @@ -170,12 +170,12 @@ export class FileEditorInput extends EditorInput implements IFileEditorInput { @memoize private get mediumTitle(): string { - return this.uriLabelService.getLabel(this.resource, true); + return this.labelService.getUriLabel(this.resource, true); } @memoize private get longTitle(): string { - return this.uriLabelService.getLabel(this.resource); + return this.labelService.getUriLabel(this.resource); } getTitle(verbosity: Verbosity): string { diff --git a/src/vs/workbench/parts/files/electron-browser/fileCommands.ts b/src/vs/workbench/parts/files/electron-browser/fileCommands.ts index a62dc4a0bdf..2e4edb6e547 100644 --- a/src/vs/workbench/parts/files/electron-browser/fileCommands.ts +++ b/src/vs/workbench/parts/files/electron-browser/fileCommands.ts @@ -41,7 +41,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService'; import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; // Commands @@ -387,11 +387,11 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ } }); -function resourcesToClipboard(resources: URI[], relative: boolean, clipboardService: IClipboardService, notificationService: INotificationService, uriLabelService: IUriLabelService): void { +function resourcesToClipboard(resources: URI[], relative: boolean, clipboardService: IClipboardService, notificationService: INotificationService, labelService: ILabelService): void { if (resources.length) { const lineDelimiter = isWindows ? '\r\n' : '\n'; - const text = resources.map(resource => uriLabelService.getLabel(resource, relative, true)) + const text = resources.map(resource => labelService.getUriLabel(resource, relative, true)) .join(lineDelimiter); clipboardService.writeText(text); } else { @@ -409,7 +409,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: COPY_PATH_COMMAND_ID, handler: (accessor, resource: URI | object) => { const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IEditorService)); - resourcesToClipboard(resources, false, accessor.get(IClipboardService), accessor.get(INotificationService), accessor.get(IUriLabelService)); + resourcesToClipboard(resources, false, accessor.get(IClipboardService), accessor.get(INotificationService), accessor.get(ILabelService)); } }); @@ -423,7 +423,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ id: COPY_RELATIVE_PATH_COMMAND_ID, handler: (accessor, resource: URI | object) => { const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IEditorService)); - resourcesToClipboard(resources, true, accessor.get(IClipboardService), accessor.get(INotificationService), accessor.get(IUriLabelService)); + resourcesToClipboard(resources, true, accessor.get(IClipboardService), accessor.get(INotificationService), accessor.get(ILabelService)); } }); @@ -436,7 +436,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({ const editorService = accessor.get(IEditorService); const activeInput = editorService.activeEditor; const resources = activeInput && activeInput.getResource() ? [activeInput.getResource()] : []; - resourcesToClipboard(resources, false, accessor.get(IClipboardService), accessor.get(INotificationService), accessor.get(IUriLabelService)); + resourcesToClipboard(resources, false, accessor.get(IClipboardService), accessor.get(INotificationService), accessor.get(ILabelService)); } }); diff --git a/src/vs/workbench/parts/files/electron-browser/files.contribution.ts b/src/vs/workbench/parts/files/electron-browser/files.contribution.ts index 39594b253a5..3e3039936bb 100644 --- a/src/vs/workbench/parts/files/electron-browser/files.contribution.ts +++ b/src/vs/workbench/parts/files/electron-browser/files.contribution.ts @@ -34,7 +34,7 @@ import { DataUriEditorInput } from 'vs/workbench/common/editor/dataUriEditorInpu import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; import { Schemas } from 'vs/base/common/network'; import { nativeSep } from 'vs/base/common/paths'; @@ -55,8 +55,8 @@ export class OpenExplorerViewletAction extends ToggleViewletAction { class FileUriLabelContribution implements IWorkbenchContribution { - constructor(@IUriLabelService uriLabelService: IUriLabelService) { - uriLabelService.registerFormater(Schemas.file, { + constructor(@ILabelService labelService: ILabelService) { + labelService.registerFormater(Schemas.file, { label: '${path}', separator: nativeSep, tildify: !platform.isWindows, diff --git a/src/vs/workbench/parts/files/electron-browser/views/explorerView.ts b/src/vs/workbench/parts/files/electron-browser/views/explorerView.ts index 59f058f4c0b..d97f3fba2d4 100644 --- a/src/vs/workbench/parts/files/electron-browser/views/explorerView.ts +++ b/src/vs/workbench/parts/files/electron-browser/views/explorerView.ts @@ -43,7 +43,7 @@ import { Schemas } from 'vs/base/common/network'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IViewletPanelOptions } from 'vs/workbench/browser/parts/views/panelViewlet'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; export interface IExplorerViewOptions extends IViewletViewOptions { viewletState: FileViewletState; @@ -96,7 +96,7 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView @IContextKeyService contextKeyService: IContextKeyService, @IConfigurationService configurationService: IConfigurationService, @IDecorationsService decorationService: IDecorationsService, - @IUriLabelService private uriLabelService: IUriLabelService + @ILabelService private labelService: ILabelService ) { super({ ...(options as IViewletPanelOptions), ariaHeaderLabel: nls.localize('explorerSection', "Files Explorer Section") }, keybindingService, contextMenuService, configurationService); @@ -149,7 +149,7 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView } public get name(): string { - return this.uriLabelService.getWorkspaceLabel(this.contextService.getWorkspace()); + return this.labelService.getWorkspaceLabel(this.contextService.getWorkspace()); } public get title(): string { diff --git a/src/vs/workbench/parts/localizations/electron-browser/localizationsActions.ts b/src/vs/workbench/parts/localizations/electron-browser/localizationsActions.ts index 3eeb2028a11..1e70b6279fa 100644 --- a/src/vs/workbench/parts/localizations/electron-browser/localizationsActions.ts +++ b/src/vs/workbench/parts/localizations/electron-browser/localizationsActions.ts @@ -13,7 +13,7 @@ import { join } from 'vs/base/common/paths'; import URI from 'vs/base/common/uri'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { language } from 'vs/base/common/platform'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; export class ConfigureLocaleAction extends Action { public static readonly ID = 'workbench.action.configureLocale'; @@ -32,7 +32,7 @@ export class ConfigureLocaleAction extends Action { @IFileService private fileService: IFileService, @IEnvironmentService private environmentService: IEnvironmentService, @IEditorService private editorService: IEditorService, - @IUriLabelService private uriLabelService: IUriLabelService + @ILabelService private labelService: ILabelService ) { super(id, label); } @@ -49,7 +49,7 @@ export class ConfigureLocaleAction extends Action { resource: stat.resource }); }, (error) => { - throw new Error(localize('fail.createSettings', "Unable to create '{0}' ({1}).", this.uriLabelService.getLabel(file, true), error)); + throw new Error(localize('fail.createSettings', "Unable to create '{0}' ({1}).", this.labelService.getUriLabel(file, true), error)); }); } } diff --git a/src/vs/workbench/parts/logs/electron-browser/logsActions.ts b/src/vs/workbench/parts/logs/electron-browser/logsActions.ts index 0920a329064..9d1ae739a25 100644 --- a/src/vs/workbench/parts/logs/electron-browser/logsActions.ts +++ b/src/vs/workbench/parts/logs/electron-browser/logsActions.ts @@ -16,7 +16,7 @@ import { ICommandService } from 'vs/platform/commands/common/commands'; import URI from 'vs/base/common/uri'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { IQuickPickItem, IQuickInputService } from 'vs/platform/quickinput/common/quickInput'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; export class OpenLogsFolderAction extends Action { @@ -44,13 +44,13 @@ export class ShowLogsAction extends Action { @IQuickInputService private quickInputService: IQuickInputService, @IOutputService private outputService: IOutputService, @IWorkspaceContextService private contextService: IWorkspaceContextService, - @IUriLabelService private uriLabelService: IUriLabelService + @ILabelService private labelService: ILabelService ) { super(id, label); } run(): TPromise { - const workspaceName = this.uriLabelService.getWorkspaceLabel(this.contextService.getWorkspace()); + const workspaceName = this.labelService.getWorkspaceLabel(this.contextService.getWorkspace()); const entries: IQuickPickItem[] = [ { id: Constants.rendererLogChannelId, label: workspaceName ? nls.localize('rendererProcess', "Window ({0})", workspaceName) : nls.localize('emptyWindow', "Window") }, { id: Constants.extHostLogChannelId, label: nls.localize('extensionHost', "Extension Host") }, @@ -79,13 +79,13 @@ export class OpenLogFileAction extends Action { @ICommandService private commandService: ICommandService, @IWindowService private windowService: IWindowService, @IWorkspaceContextService private contextService: IWorkspaceContextService, - @IUriLabelService private uriLabelService: IUriLabelService + @ILabelService private labelService: ILabelService ) { super(id, label); } run(): TPromise { - const workspaceName = this.uriLabelService.getWorkspaceLabel(this.contextService.getWorkspace()); + const workspaceName = this.labelService.getWorkspaceLabel(this.contextService.getWorkspace()); const entries: IQuickPickItem[] = [ { id: URI.file(paths.join(this.environmentService.logsPath, `renderer${this.windowService.getCurrentWindowId()}.log`)).fsPath, label: workspaceName ? nls.localize('rendererProcess', "Window ({0})", workspaceName) : nls.localize('emptyWindow', "Window") }, { id: URI.file(paths.join(this.environmentService.logsPath, `exthost${this.windowService.getCurrentWindowId()}.log`)).fsPath, label: nls.localize('extensionHost', "Extension Host") }, diff --git a/src/vs/workbench/parts/markers/electron-browser/markersTreeViewer.ts b/src/vs/workbench/parts/markers/electron-browser/markersTreeViewer.ts index 60deb20c1e7..4e35e7e3ccb 100644 --- a/src/vs/workbench/parts/markers/electron-browser/markersTreeViewer.ts +++ b/src/vs/workbench/parts/markers/electron-browser/markersTreeViewer.ts @@ -21,7 +21,7 @@ import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IDisposable } from 'vs/base/common/lifecycle'; import { ActionBar, IActionItemProvider } from 'vs/base/browser/ui/actionbar/actionbar'; import { QuickFixAction } from 'vs/workbench/parts/markers/electron-browser/markersPanelActions'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; import { dirname } from 'vs/base/common/resources'; interface IResourceMarkersTemplateData { @@ -100,7 +100,7 @@ export class Renderer implements IRenderer { private actionItemProvider: IActionItemProvider, @IInstantiationService private instantiationService: IInstantiationService, @IThemeService private themeService: IThemeService, - @IUriLabelService private uriLabelService: IUriLabelService + @ILabelService private labelService: ILabelService ) { } @@ -209,7 +209,7 @@ export class Renderer implements IRenderer { if (templateData.resourceLabel instanceof FileLabel) { templateData.resourceLabel.setFile(element.uri, { matches: element.uriMatches }); } else { - templateData.resourceLabel.setLabel({ name: element.name, description: this.uriLabelService.getLabel(dirname(element.uri), true), resource: element.uri }, { matches: element.uriMatches }); + templateData.resourceLabel.setLabel({ name: element.name, description: this.labelService.getUriLabel(dirname(element.uri), true), resource: element.uri }, { matches: element.uriMatches }); } (templateData).count.setCount(element.filteredCount); } @@ -235,7 +235,7 @@ export class Renderer implements IRenderer { private renderRelatedInfoElement(tree: ITree, element: RelatedInformation, templateData: IRelatedInformationTemplateData) { templateData.resourceLabel.set(paths.basename(element.raw.resource.fsPath), element.uriMatches); - templateData.resourceLabel.element.title = this.uriLabelService.getLabel(element.raw.resource, true); + templateData.resourceLabel.element.title = this.labelService.getUriLabel(element.raw.resource, true); templateData.lnCol.textContent = Messages.MARKERS_PANEL_AT_LINE_COL_NUMBER(element.raw.startLineNumber, element.raw.startColumn); templateData.description.set(element.raw.message, element.messageMatches); templateData.description.element.title = element.raw.message; @@ -273,13 +273,13 @@ export class Renderer implements IRenderer { export class MarkersTreeAccessibilityProvider implements IAccessibilityProvider { constructor( - @IUriLabelService private uriLabelServie: IUriLabelService + @ILabelService private labelServie: ILabelService ) { } public getAriaLabel(tree: ITree, element: any): string { if (element instanceof ResourceMarkers) { - const path = this.uriLabelServie.getLabel(element.uri, true) || element.uri.fsPath; + const path = this.labelServie.getUriLabel(element.uri, true) || element.uri.fsPath; return Messages.MARKERS_TREE_ARIA_LABEL_RESOURCE(element.filteredCount, element.name, paths.dirname(path)); } if (element instanceof Marker) { diff --git a/src/vs/workbench/parts/search/browser/openFileHandler.ts b/src/vs/workbench/parts/search/browser/openFileHandler.ts index ea39b43e3b4..74ecdb47103 100644 --- a/src/vs/workbench/parts/search/browser/openFileHandler.ts +++ b/src/vs/workbench/parts/search/browser/openFileHandler.ts @@ -33,7 +33,7 @@ import { getOutOfWorkspaceEditorResources } from 'vs/workbench/parts/search/comm import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { prepareQuery, IPreparedQuery } from 'vs/base/parts/quickopen/common/quickOpenScorer'; import { IFileService } from 'vs/platform/files/common/files'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; import { untildify } from 'vs/base/common/labels'; export class FileQuickOpenModel extends QuickOpenModel { @@ -127,7 +127,7 @@ export class OpenFileHandler extends QuickOpenHandler { @ISearchService private searchService: ISearchService, @IEnvironmentService private environmentService: IEnvironmentService, @IFileService private fileService: IFileService, - @IUriLabelService private uriLabelService: IUriLabelService + @ILabelService private labelService: ILabelService ) { super(); @@ -173,7 +173,7 @@ export class OpenFileHandler extends QuickOpenHandler { const fileMatch = complete.results[i]; const label = paths.basename(fileMatch.resource.fsPath); - const description = this.uriLabelService.getLabel(resources.dirname(fileMatch.resource), true); + const description = this.labelService.getUriLabel(resources.dirname(fileMatch.resource), true); results.push(this.instantiationService.createInstance(FileEntry, fileMatch.resource, label, description, iconClass)); } diff --git a/src/vs/workbench/parts/search/browser/openSymbolHandler.ts b/src/vs/workbench/parts/search/browser/openSymbolHandler.ts index cf6acbc1f1e..14a26b1b5de 100644 --- a/src/vs/workbench/parts/search/browser/openSymbolHandler.ts +++ b/src/vs/workbench/parts/search/browser/openSymbolHandler.ts @@ -23,7 +23,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur import { IWorkspaceSymbolProvider, getWorkspaceSymbols, IWorkspaceSymbol } from 'vs/workbench/parts/search/common/search'; import { basename } from 'vs/base/common/paths'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; class SymbolEntry extends EditorQuickOpenEntry { @@ -34,7 +34,7 @@ class SymbolEntry extends EditorQuickOpenEntry { private _provider: IWorkspaceSymbolProvider, @IConfigurationService private readonly _configurationService: IConfigurationService, @IEditorService editorService: IEditorService, - @IUriLabelService private _uriLabelService: IUriLabelService + @ILabelService private _labelService: ILabelService ) { super(editorService); } @@ -53,7 +53,7 @@ class SymbolEntry extends EditorQuickOpenEntry { if (containerName) { return `${containerName} — ${basename(this._bearing.location.uri.fsPath)}`; } else { - return this._uriLabelService.getLabel(this._bearing.location.uri, true); + return this._labelService.getUriLabel(this._bearing.location.uri, true); } } return containerName; diff --git a/src/vs/workbench/parts/search/browser/searchResultsView.ts b/src/vs/workbench/parts/search/browser/searchResultsView.ts index 628d70b17e7..88e4943184b 100644 --- a/src/vs/workbench/parts/search/browser/searchResultsView.ts +++ b/src/vs/workbench/parts/search/browser/searchResultsView.ts @@ -27,7 +27,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView import { IMenuService, MenuId, IMenu } from 'vs/platform/actions/common/actions'; import { WorkbenchTreeController, WorkbenchTree } from 'vs/platform/list/browser/listService'; import { fillInContextMenuActions } from 'vs/platform/actions/browser/menuItemActionItem'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; export class SearchDataSource implements IDataSource { @@ -329,7 +329,7 @@ export class SearchRenderer extends Disposable implements IRenderer { export class SearchAccessibilityProvider implements IAccessibilityProvider { constructor( - @IUriLabelService private uriLabelService: IUriLabelService + @ILabelService private labelService: ILabelService ) { } @@ -341,7 +341,7 @@ export class SearchAccessibilityProvider implements IAccessibilityProvider { } if (element instanceof FileMatch) { - const path = this.uriLabelService.getLabel(element.resource(), true) || element.resource().fsPath; + const path = this.labelService.getUriLabel(element.resource(), true) || element.resource().fsPath; return nls.localize('fileMatchAriaLabel', "{0} matches in file {1} of folder {2}, Search result", element.count(), element.name(), paths.dirname(path)); } diff --git a/src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.ts b/src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.ts index d0a84ee058b..f2b267da9e9 100644 --- a/src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.ts +++ b/src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.ts @@ -39,7 +39,7 @@ import { getIdAndVersionFromLocalExtensionId } from 'vs/platform/extensionManage import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; import { TimeoutTimer } from 'vs/base/common/async'; import { areSameExtensions } from 'vs/platform/extensionManagement/common/extensionManagementUtil'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; used(); @@ -223,7 +223,7 @@ class WelcomePage { @IWorkspaceContextService private contextService: IWorkspaceContextService, @IConfigurationService private configurationService: IConfigurationService, @IEnvironmentService private environmentService: IEnvironmentService, - @IUriLabelService private uriLabelService: IUriLabelService, + @ILabelService private labelService: ILabelService, @INotificationService private notificationService: INotificationService, @IExtensionEnablementService private extensionEnablementService: IExtensionEnablementService, @IExtensionGalleryService private extensionGalleryService: IExtensionGalleryService, @@ -280,9 +280,9 @@ class WelcomePage { let resource: URI; if (isSingleFolderWorkspaceIdentifier(workspace)) { resource = workspace; - label = this.uriLabelService.getWorkspaceLabel(workspace); + label = this.labelService.getWorkspaceLabel(workspace); } else if (isWorkspaceIdentifier(workspace)) { - label = this.uriLabelService.getWorkspaceLabel(workspace); + label = this.labelService.getWorkspaceLabel(workspace); resource = URI.file(workspace.configPath); } else { label = getBaseLabel(workspace); @@ -304,7 +304,7 @@ class WelcomePage { } parentFolderPath = tildify(parentFolder, this.environmentService.userHome); } else { - parentFolderPath = this.uriLabelService.getLabel(resource); + parentFolderPath = this.labelService.getUriLabel(resource); } diff --git a/src/vs/workbench/services/bulkEdit/electron-browser/bulkEditService.ts b/src/vs/workbench/services/bulkEdit/electron-browser/bulkEditService.ts index 8e787b56880..8086e115ae4 100644 --- a/src/vs/workbench/services/bulkEdit/electron-browser/bulkEditService.ts +++ b/src/vs/workbench/services/bulkEdit/electron-browser/bulkEditService.ts @@ -24,7 +24,7 @@ import { ILogService } from 'vs/platform/log/common/log'; import { emptyProgressRunner, IProgress, IProgressRunner } from 'vs/platform/progress/common/progress'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; abstract class Recording { @@ -236,7 +236,7 @@ export class BulkEdit { @ITextModelService private readonly _textModelService: ITextModelService, @IFileService private readonly _fileService: IFileService, @ITextFileService private readonly _textFileService: ITextFileService, - @IUriLabelService private readonly _uriLabelServie: IUriLabelService + @ILabelService private readonly _uriLabelServie: ILabelService ) { this._editor = editor; this._progress = progress || emptyProgressRunner; @@ -342,7 +342,7 @@ export class BulkEdit { const conflicts = edits .filter(edit => recording.hasChanged(edit.resource)) - .map(edit => this._uriLabelServie.getLabel(edit.resource, true)); + .map(edit => this._uriLabelServie.getUriLabel(edit.resource, true)); recording.stop(); @@ -372,7 +372,7 @@ export class BulkEditService implements IBulkEditService { @ITextModelService private readonly _textModelService: ITextModelService, @IFileService private readonly _fileService: IFileService, @ITextFileService private readonly _textFileService: ITextFileService, - @IUriLabelService private readonly _uriLabelService: IUriLabelService + @ILabelService private readonly _labelService: ILabelService ) { } @@ -403,7 +403,7 @@ export class BulkEditService implements IBulkEditService { } } - const bulkEdit = new BulkEdit(options.editor, options.progress, this._logService, this._textModelService, this._fileService, this._textFileService, this._uriLabelService); + const bulkEdit = new BulkEdit(options.editor, options.progress, this._logService, this._textModelService, this._fileService, this._textFileService, this._labelService); bulkEdit.add(edits); return TPromise.wrap(bulkEdit.perform().then(() => { diff --git a/src/vs/workbench/services/editor/browser/editorService.ts b/src/vs/workbench/services/editor/browser/editorService.ts index 32c50e0a867..1ee855ef3d5 100644 --- a/src/vs/workbench/services/editor/browser/editorService.ts +++ b/src/vs/workbench/services/editor/browser/editorService.ts @@ -28,7 +28,7 @@ import { Disposable, IDisposable, dispose, toDisposable } from 'vs/base/common/l import { coalesce } from 'vs/base/common/arrays'; import { isCodeEditor, isDiffEditor, ICodeEditor, IDiffEditor } from 'vs/editor/browser/editorBrowser'; import { IEditorGroupView, IEditorOpeningEvent, EditorGroupsServiceImpl, EditorServiceImpl } from 'vs/workbench/browser/parts/editor/editor'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; type ICachedEditorInput = ResourceEditorInput | IFileEditorInput | DataUriEditorInput; @@ -64,7 +64,7 @@ export class EditorService extends Disposable implements EditorServiceImpl { @IEditorGroupsService private editorGroupService: EditorGroupsServiceImpl, @IUntitledEditorService private untitledEditorService: IUntitledEditorService, @IInstantiationService private instantiationService: IInstantiationService, - @IUriLabelService private uriLabelService: IUriLabelService, + @ILabelService private labelService: ILabelService, @IFileService private fileService: IFileService, @IConfigurationService private configurationService: IConfigurationService ) { @@ -563,7 +563,7 @@ export class EditorService extends Disposable implements EditorServiceImpl { } // Otherwise: for diff labels prefer to see the path as part of the label - return this.uriLabelService.getLabel(res, true); + return this.labelService.getUriLabel(res, true); } //#endregion @@ -584,7 +584,7 @@ export class DelegatingEditorService extends EditorService { @IEditorGroupsService editorGroupService: EditorGroupsServiceImpl, @IUntitledEditorService untitledEditorService: IUntitledEditorService, @IInstantiationService instantiationService: IInstantiationService, - @IUriLabelService uriLabelService: IUriLabelService, + @ILabelService labelService: ILabelService, @IFileService fileService: IFileService, @IConfigurationService configurationService: IConfigurationService ) { @@ -592,7 +592,7 @@ export class DelegatingEditorService extends EditorService { editorGroupService, untitledEditorService, instantiationService, - uriLabelService, + labelService, fileService, configurationService ); diff --git a/src/vs/workbench/services/extensions/electron-browser/extensionHost.ts b/src/vs/workbench/services/extensions/electron-browser/extensionHost.ts index d74d74631cc..6919dec0c92 100644 --- a/src/vs/workbench/services/extensions/electron-browser/extensionHost.ts +++ b/src/vs/workbench/services/extensions/electron-browser/extensionHost.ts @@ -38,7 +38,7 @@ import { INotificationService, Severity } from 'vs/platform/notification/common/ import { getPathFromAmdModule } from 'vs/base/common/amd'; import { timeout } from 'vs/base/common/async'; import { isMessageOfType, MessageType, createMessageOfType } from 'vs/workbench/common/extensionHostProtocol'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; export interface IExtensionHostStarter { readonly onCrashed: Event<[number, string]>; @@ -83,7 +83,7 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter { @ITelemetryService private readonly _telemetryService: ITelemetryService, @ICrashReporterService private readonly _crashReporterService: ICrashReporterService, @ILogService private readonly _logService: ILogService, - @IUriLabelService private readonly _uriLabelService: IUriLabelService + @ILabelService private readonly _labelService: ILabelService ) { // handle extension host lifecycle a bit special when we know we are developing an extension that runs inside this._isExtensionDevHost = this._environmentService.isExtensionDevelopment; @@ -387,7 +387,7 @@ export class ExtensionHostProcessWorker implements IExtensionHostStarter { configuration: workspace.configuration, folders: workspace.folders, id: workspace.id, - name: this._uriLabelService.getWorkspaceLabel(workspace) + name: this._labelService.getWorkspaceLabel(workspace) }, extensions: extensionDescriptions, // Send configurations scopes only in development mode. diff --git a/src/vs/workbench/services/preferences/browser/preferencesService.ts b/src/vs/workbench/services/preferences/browser/preferencesService.ts index c7d519cf89f..77a3cc9a1af 100644 --- a/src/vs/workbench/services/preferences/browser/preferencesService.ts +++ b/src/vs/workbench/services/preferences/browser/preferencesService.ts @@ -36,7 +36,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati import { assign } from 'vs/base/common/objects'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IEditorGroup, IEditorGroupsService, GroupDirection } from 'vs/workbench/services/group/common/editorGroupsService'; -import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService } from 'vs/platform/label/common/label'; const emptyEditableSettingsContent = '{\n}'; @@ -71,7 +71,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic @IModelService private modelService: IModelService, @IJSONEditingService private jsonEditingService: IJSONEditingService, @IModeService private modeService: IModeService, - @IUriLabelService private uriLabelService: IUriLabelService + @ILabelService private labelService: ILabelService ) { super(); // The default keybindings.json updates based on keyboard layouts, so here we make sure @@ -508,7 +508,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic return this.fileService.resolveContent(resource, { acceptTextOnly: true }).then(null, error => { if ((error).fileOperationResult === FileOperationResult.FILE_NOT_FOUND) { return this.fileService.updateContent(resource, contents).then(null, error => { - return TPromise.wrapError(new Error(nls.localize('fail.createSettings', "Unable to create '{0}' ({1}).", this.uriLabelService.getLabel(resource, true), error))); + return TPromise.wrapError(new Error(nls.localize('fail.createSettings', "Unable to create '{0}' ({1}).", this.labelService.getUriLabel(resource, true), error))); }); } diff --git a/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts b/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts index 19ef6688f08..047e1cdd3da 100644 --- a/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts +++ b/src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts @@ -28,7 +28,7 @@ import { BulkEditService } from 'vs/workbench/services/bulkEdit/electron-browser import { NullLogService } from 'vs/platform/log/common/log'; import { ITextModelService, ITextEditorModel } from 'vs/editor/common/services/resolverService'; import { IReference, ImmortalReference } from 'vs/base/common/lifecycle'; -import { UriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { LabelService } from 'vs/platform/label/common/label'; suite('MainThreadEditors', () => { @@ -84,7 +84,7 @@ suite('MainThreadEditors', () => { } }; - const bulkEditService = new BulkEditService(new NullLogService(), modelService, new TestEditorService(), textModelService, new TestFileService(), textFileService, new UriLabelService(TestEnvironmentService, new TestContextService())); + const bulkEditService = new BulkEditService(new NullLogService(), modelService, new TestEditorService(), textModelService, new TestFileService(), textFileService, new LabelService(TestEnvironmentService, new TestContextService())); const rpcProtocol = new TestRPCProtocol(); rpcProtocol.set(ExtHostContext.ExtHostDocuments, new class extends mock() { diff --git a/src/vs/workbench/test/workbenchTestServices.ts b/src/vs/workbench/test/workbenchTestServices.ts index 28b58ffa681..cd10de36a94 100644 --- a/src/vs/workbench/test/workbenchTestServices.ts +++ b/src/vs/workbench/test/workbenchTestServices.ts @@ -75,7 +75,7 @@ import { IDecorationRenderOptions } from 'vs/editor/common/editorCommon'; import { EditorGroup } from 'vs/workbench/common/editor/editorGroup'; import { Dimension } from 'vs/base/browser/dom'; import { ILogService, LogLevel } from 'vs/platform/log/common/log'; -import { IUriLabelService, UriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; +import { ILabelService, LabelService } from 'vs/platform/label/common/label'; export function createFileInput(instantiationService: IInstantiationService, resource: URI): FileEditorInput { return instantiationService.createInstance(FileEditorInput, resource, void 0); @@ -271,7 +271,7 @@ export function workbenchInstantiationService(): IInstantiationService { instantiationService.stub(IHashService, new TestHashService()); instantiationService.stub(ILogService, new TestLogService()); instantiationService.stub(IEditorGroupsService, new TestEditorGroupsService([new TestEditorGroup(0)])); - instantiationService.stub(IUriLabelService, new UriLabelService(TestEnvironmentService, workspaceContextService)); + instantiationService.stub(ILabelService, new LabelService(TestEnvironmentService, workspaceContextService)); const editorService = new TestEditorService(); instantiationService.stub(IEditorService, editorService); instantiationService.stub(ICodeEditorService, new TestCodeEditorService()); diff --git a/src/vs/workbench/workbench.main.ts b/src/vs/workbench/workbench.main.ts index 184ccb27ce7..ce9193eb9cf 100644 --- a/src/vs/workbench/workbench.main.ts +++ b/src/vs/workbench/workbench.main.ts @@ -17,7 +17,7 @@ import 'vs/editor/editor.all'; // Platform import 'vs/platform/widget/browser/contextScopedHistoryWidget'; -import 'vs/platform/uriLabel/electron-browser/uriLabel.contribution'; +import 'vs/platform/label/electron-browser/label.contribution'; // Menus/Actions import 'vs/workbench/services/actions/electron-browser/menusExtensionPoint';