diff --git a/src/vs/code/electron-main/app.ts b/src/vs/code/electron-main/app.ts index be65769bfce..c0185b039e9 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/common/menubarIpc'; -import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; 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, - @IUriDisplayService private uriDisplayService: IUriDisplayService + @IUriLabelService private uriLabelService: IUriLabelService ) { this.toDispose = [mainIpcServer, configurationService]; @@ -225,8 +225,8 @@ export class CodeApplication { } }); - ipc.on('vscode:uriDisplayRegisterFormater', (event: any, { scheme, formater }) => { - this.uriDisplayService.registerFormater(scheme, formater); + ipc.on('vscode:uriLabelRegisterFormater', (event: any, { scheme, formater }) => { + this.uriLabelService.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 060c2459c5f..dbe95eb11e2 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 { IUriDisplayService, UriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService, UriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; 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 uriDisplayService = new UriDisplayService(environmentService, undefined); + const uriLabelService = new UriLabelService(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(IUriDisplayService, uriDisplayService); + services.set(IUriLabelService, uriLabelService); 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 7f2a3082e0c..1bbfd9834bb 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, getWorkspaceLabel, 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 { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; const telemetryFrom = 'menu'; @@ -49,7 +49,7 @@ export class Menubar { @IEnvironmentService private environmentService: IEnvironmentService, @ITelemetryService private telemetryService: ITelemetryService, @IHistoryMainService private historyMainService: IHistoryMainService, - @IUriDisplayService private uriDisplayService: IUriDisplayService + @IUriLabelService private uriLabelService: IUriLabelService ) { 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(getWorkspaceLabel(workspaceOrFile, this.environmentService, this.uriDisplayService, { verbose: true })); + label = unmnemonicLabel(getWorkspaceLabel(workspaceOrFile, this.environmentService, this.uriLabelService, { verbose: true })); uri = workspaceOrFile; } else if (isWorkspaceIdentifier(workspaceOrFile)) { - label = getWorkspaceLabel(workspaceOrFile, this.environmentService, this.uriDisplayService, { verbose: true }); + label = getWorkspaceLabel(workspaceOrFile, this.environmentService, this.uriLabelService, { verbose: true }); uri = URI.file(workspaceOrFile.configPath); } else { - label = unmnemonicLabel(this.uriDisplayService.getLabel(workspaceOrFile)); + label = unmnemonicLabel(this.uriLabelService.getLabel(workspaceOrFile)); uri = workspaceOrFile; } diff --git a/src/vs/code/electron-main/menus.ts b/src/vs/code/electron-main/menus.ts index 916bd309bcc..9d5657cff26 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, getWorkspaceLabel, ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces'; import URI from 'vs/base/common/uri'; -import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; 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, - @IUriDisplayService private uriDisplayService: IUriDisplayService + @IUriLabelService private uriLabelService: IUriLabelService ) { this.nativeTabMenuItems = []; @@ -496,14 +496,14 @@ export class CodeMenu { let label: string; let uri: URI; if (isSingleFolderWorkspaceIdentifier(workspace)) { - label = unmnemonicLabel(getWorkspaceLabel(workspace, this.environmentService, this.uriDisplayService, { verbose: true })); + label = unmnemonicLabel(getWorkspaceLabel(workspace, this.environmentService, this.uriLabelService, { verbose: true })); uri = workspace; } else if (isWorkspaceIdentifier(workspace)) { - label = getWorkspaceLabel(workspace, this.environmentService, this.uriDisplayService, { verbose: true }); + label = getWorkspaceLabel(workspace, this.environmentService, this.uriLabelService, { verbose: true }); uri = URI.file(workspace.configPath); } else { uri = URI.file(workspace); - label = unmnemonicLabel(this.uriDisplayService.getLabel(uri)); + label = unmnemonicLabel(this.uriLabelService.getLabel(uri)); } return new MenuItem(this.likeAction(commandId, { @@ -1319,4 +1319,4 @@ export class CodeMenu { function __separator__(): Electron.MenuItem { return new MenuItem({ type: 'separator' }); -} \ No newline at end of file +} diff --git a/src/vs/editor/contrib/referenceSearch/referencesWidget.ts b/src/vs/editor/contrib/referenceSearch/referencesWidget.ts index 45fd356d9d9..da6bf29eb68 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 { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; import { dirname, basenameOrAuthority } from 'vs/base/common/resources'; import { getBaseLabel } from 'vs/base/common/labels'; @@ -300,7 +300,7 @@ class FileReferencesTemplate { constructor( container: HTMLElement, - @IUriDisplayService private readonly _uriDisplay: IUriDisplayService, + @IUriLabelService private readonly _uriLabel: IUriLabelService, @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._uriDisplay.getLabel(parent, true) : undefined, { title: this._uriDisplay.getLabel(element.uri) }); + this.file.setValue(getBaseLabel(element.uri), parent ? this._uriLabel.getLabel(parent, true) : undefined, { title: this._uriLabel.getLabel(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, - @IUriDisplayService private readonly _uriDisplay: IUriDisplayService, + @IUriLabelService private readonly _uriLabel: IUriLabelService, ) { // } @@ -388,7 +388,7 @@ class Renderer implements tree.IRenderer { renderTemplate(tree: tree.ITree, templateId: string, container: HTMLElement) { if (templateId === Renderer._ids.FileReferences) { - return new FileReferencesTemplate(container, this._uriDisplay, this._themeService); + return new FileReferencesTemplate(container, this._uriLabel, this._themeService); } else if (templateId === Renderer._ids.OneReference) { return new OneReferenceTemplate(container); } @@ -532,7 +532,7 @@ export class ReferenceWidget extends PeekViewWidget { @IThemeService themeService: IThemeService, @ITextModelService private _textModelResolverService: ITextModelService, @IInstantiationService private _instantiationService: IInstantiationService, - @IUriDisplayService private _uriDisplay: IUriDisplayService + @IUriLabelService private _uriLabel: IUriLabelService ) { 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._uriDisplay.getLabel(dirname(reference.uri), false)); + this.setTitle(basenameOrAuthority(reference.uri), this._uriLabel.getLabel(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 b3d9dbf7f14..231c2e182c3 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 { IUriDisplayService, UriDisplayRules } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService, UriLabelRules } from 'vs/platform/uriLabel/common/uriLabel'; export class SimpleModel implements ITextEditorModel { @@ -592,11 +592,11 @@ export class SimpleBulkEditService implements IBulkEditService { } } -export class SimpleUriDisplayService implements IUriDisplayService { +export class SimpleUriLabelService implements IUriLabelService { _serviceBrand: any; - private readonly _onDidRegisterFormater: Emitter<{ scheme: string, formater: UriDisplayRules }> = new Emitter<{ scheme: string, formater: UriDisplayRules }>(); - public readonly onDidRegisterFormater: Event<{ scheme: string, formater: UriDisplayRules }> = this._onDidRegisterFormater.event; + 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 { if (resource.scheme === 'file') { @@ -605,7 +605,7 @@ export class SimpleUriDisplayService implements IUriDisplayService { return resource.path; } - public registerFormater(schema: string, formater: UriDisplayRules): IDisposable { + public registerFormater(schema: string, formater: UriLabelRules): IDisposable { throw new Error('Not implemented'); } } diff --git a/src/vs/editor/standalone/browser/standaloneServices.ts b/src/vs/editor/standalone/browser/standaloneServices.ts index 49375edbcff..d20dc25b60e 100644 --- a/src/vs/editor/standalone/browser/standaloneServices.ts +++ b/src/vs/editor/standalone/browser/standaloneServices.ts @@ -33,7 +33,7 @@ import { StandaloneCodeEditorServiceImpl } from 'vs/editor/standalone/browser/st import { SimpleConfigurationService, SimpleResourceConfigurationService, SimpleMenuService, SimpleProgressService, StandaloneCommandService, StandaloneKeybindingService, SimpleNotificationService, - StandaloneTelemetryService, SimpleWorkspaceContextService, SimpleDialogService, SimpleBulkEditService, SimpleUriDisplayService + StandaloneTelemetryService, SimpleWorkspaceContextService, SimpleDialogService, SimpleBulkEditService, SimpleUriLabelService } from 'vs/editor/standalone/browser/simpleServices'; import { ContextKeyService } from 'vs/platform/contextkey/browser/contextKeyService'; import { IMenuService } from 'vs/platform/actions/common/actions'; @@ -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 { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; export interface IEditorOverrideServices { [index: string]: any; @@ -122,7 +122,7 @@ export module StaticServices { export const contextService = define(IWorkspaceContextService, () => new SimpleWorkspaceContextService()); - export const uriDisplayService = define(IUriDisplayService, () => new SimpleUriDisplayService()); + export const uriLabelService = define(IUriLabelService, () => 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 0308dfe3063..3f2657d3851 100644 --- a/src/vs/platform/history/electron-main/historyMainService.ts +++ b/src/vs/platform/history/electron-main/historyMainService.ts @@ -22,7 +22,7 @@ import { RunOnceScheduler } from 'vs/base/common/async'; import { getComparisonKey, isEqual as areResourcesEqual, hasToIgnoreCase, dirname } from 'vs/base/common/resources'; import URI, { UriComponents } from 'vs/base/common/uri'; import { Schemas } from 'vs/base/common/network'; -import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; interface ISerializedRecentlyOpened { workspaces2: (IWorkspaceIdentifier | string)[]; // IWorkspaceIdentifier or URI.toString() @@ -53,7 +53,7 @@ export class HistoryMainService implements IHistoryMainService { @ILogService private logService: ILogService, @IWorkspacesMainService private workspacesMainService: IWorkspacesMainService, @IEnvironmentService private environmentService: IEnvironmentService, - @IUriDisplayService private uriDisplayService: IUriDisplayService + @IUriLabelService private uriLabelService: IUriLabelService ) { this.macOSRecentDocumentsUpdater = new RunOnceScheduler(() => this.updateMacOSRecentDocuments(), 800); @@ -368,11 +368,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 = getWorkspaceLabel(workspace, this.environmentService, this.uriDisplayService); + const title = getWorkspaceLabel(workspace, this.environmentService, this.uriLabelService); let description; let args; if (isSingleFolderWorkspaceIdentifier(workspace)) { - description = nls.localize('folderDesc', "{0} {1}", getBaseLabel(workspace), this.uriDisplayService.getLabel(dirname(workspace))); + description = nls.localize('folderDesc', "{0} {1}", getBaseLabel(workspace), this.uriLabelService.getLabel(dirname(workspace))); args = `--folder-uri "${workspace.toString()}"`; } else { description = nls.localize('codeWorkspace', "Code Workspace"); diff --git a/src/vs/platform/uriDisplay/common/uriDisplay.ts b/src/vs/platform/uriLabel/common/uriLabel.ts similarity index 84% rename from src/vs/platform/uriDisplay/common/uriDisplay.ts rename to src/vs/platform/uriLabel/common/uriLabel.ts index cd53cee444f..f8c3a424a67 100644 --- a/src/vs/platform/uriDisplay/common/uriDisplay.ts +++ b/src/vs/platform/uriLabel/common/uriLabel.ts @@ -14,21 +14,21 @@ import { isLinux, isWindows } from 'vs/base/common/platform'; import { tildify, getPathLabel } from 'vs/base/common/labels'; import { ltrim } from 'vs/base/common/strings'; -export interface IUriDisplayService { +export interface IUriLabelService { _serviceBrand: any; getLabel(resource: URI, relative?: boolean): string; - registerFormater(schema: string, formater: UriDisplayRules): IDisposable; - onDidRegisterFormater: Event<{ scheme: string, formater: UriDisplayRules }>; + registerFormater(schema: string, formater: UriLabelRules): IDisposable; + onDidRegisterFormater: Event<{ scheme: string, formater: UriLabelRules }>; } -export interface UriDisplayRules { +export interface UriLabelRules { label: string; // myLabel:/${path} separator: '/' | '\\' | ''; tildify?: boolean; normalizeDriveLetter?: boolean; } -const URI_DISPLAY_SERVICE_ID = 'uriDisplay'; +const URI_LABEL_SERVICE_ID = 'uriLabel'; const sepRegexp = /\//g; const labelMatchingRegexp = /\$\{scheme\}|\$\{authority\}|\$\{path\}/g; @@ -36,11 +36,11 @@ function hasDriveLetter(path: string): boolean { return isWindows && path && path[2] === ':'; } -export class UriDisplayService implements IUriDisplayService { +export class UriLabelService implements IUriLabelService { _serviceBrand: any; - private readonly formaters = new Map(); - private readonly _onDidRegisterFormater = new Emitter<{ scheme: string, formater: UriDisplayRules }>(); + private readonly formaters = new Map(); + private readonly _onDidRegisterFormater = new Emitter<{ scheme: string, formater: UriLabelRules }>(); constructor( @IEnvironmentService private environmentService: IEnvironmentService, @@ -48,7 +48,7 @@ export class UriDisplayService implements IUriDisplayService { ) { } - get onDidRegisterFormater(): Event<{ scheme: string, formater: UriDisplayRules }> { + get onDidRegisterFormater(): Event<{ scheme: string, formater: UriLabelRules }> { return this._onDidRegisterFormater.event; } @@ -85,7 +85,7 @@ export class UriDisplayService implements IUriDisplayService { return this.formatUri(resource, formater); } - registerFormater(scheme: string, formater: UriDisplayRules): IDisposable { + registerFormater(scheme: string, formater: UriLabelRules): IDisposable { this.formaters.set(scheme, formater); this._onDidRegisterFormater.fire({ scheme, formater }); @@ -94,7 +94,7 @@ export class UriDisplayService implements IUriDisplayService { }; } - private formatUri(resource: URI, formater: UriDisplayRules): string { + private formatUri(resource: URI, formater: UriLabelRules): string { let label = formater.label.replace(labelMatchingRegexp, match => { switch (match) { case '${scheme}': return resource.scheme; @@ -117,4 +117,4 @@ export class UriDisplayService implements IUriDisplayService { } } -export const IUriDisplayService = createDecorator(URI_DISPLAY_SERVICE_ID); +export const IUriLabelService = createDecorator(URI_LABEL_SERVICE_ID); diff --git a/src/vs/platform/uriDisplay/electron-browser/uriDisplay.contribution.ts b/src/vs/platform/uriLabel/electron-browser/uriLabel.contribution.ts similarity index 67% rename from src/vs/platform/uriDisplay/electron-browser/uriDisplay.contribution.ts rename to src/vs/platform/uriLabel/electron-browser/uriLabel.contribution.ts index 9637712a2ec..bbd24220002 100644 --- a/src/vs/platform/uriDisplay/electron-browser/uriDisplay.contribution.ts +++ b/src/vs/platform/uriLabel/electron-browser/uriLabel.contribution.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; -import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; 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 UriDisplayRegistrationContribution implements IWorkbenchContribution { +class UriLabelRegistrationContribution implements IWorkbenchContribution { - constructor(@IUriDisplayService uriDisplayService: IUriDisplayService) { - uriDisplayService.onDidRegisterFormater(data => { - ipc.send('vscode:uriDisplayRegisterFormater', data); + constructor(@IUriLabelService uriLabelService: IUriLabelService) { + uriLabelService.onDidRegisterFormater(data => { + ipc.send('vscode:uriLabelRegisterFormater', data); }); } } -Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(UriDisplayRegistrationContribution, LifecyclePhase.Starting); +Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(UriLabelRegistrationContribution, LifecyclePhase.Starting); diff --git a/src/vs/platform/uriDisplay/test/uriDisplay.test.ts b/src/vs/platform/uriLabel/test/uriLabel.test.ts similarity index 62% rename from src/vs/platform/uriDisplay/test/uriDisplay.test.ts rename to src/vs/platform/uriLabel/test/uriLabel.test.ts index a54cc2318b4..8b36579e453 100644 --- a/src/vs/platform/uriDisplay/test/uriDisplay.test.ts +++ b/src/vs/platform/uriLabel/test/uriLabel.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; -import { IUriDisplayService, UriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService, UriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; import { TestEnvironmentService, TestContextService } from 'vs/workbench/test/workbenchTestServices'; import { Schemas } from 'vs/base/common/network'; import { TestWorkspace } from 'vs/platform/workspace/test/common/testWorkspace'; @@ -12,16 +12,16 @@ import URI from 'vs/base/common/uri'; import { nativeSep } from 'vs/base/common/paths'; import { isWindows } from 'vs/base/common/platform'; -suite('URI Display', () => { +suite('URI Label', () => { - let uriDisplayService: IUriDisplayService; + let uriLabelService: IUriLabelService; setup(() => { - uriDisplayService = new UriDisplayService(TestEnvironmentService, new TestContextService()); + uriLabelService = new UriLabelService(TestEnvironmentService, new TestContextService()); }); test('file scheme', function () { - uriDisplayService.registerFormater(Schemas.file, { + uriLabelService.registerFormater(Schemas.file, { label: '${path}', separator: nativeSep, tildify: !isWindows, @@ -29,15 +29,15 @@ suite('URI Display', () => { }); const uri1 = TestWorkspace.folders[0].uri.with({ path: TestWorkspace.folders[0].uri.path.concat('/a/b/c/d') }); - assert.equal(uriDisplayService.getLabel(uri1, true), isWindows ? 'a\\b\\c\\d' : 'a/b/c/d'); - assert.equal(uriDisplayService.getLabel(uri1, false), isWindows ? 'C:\\testWorkspace\\a\\b\\c\\d' : '/testWorkspace/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'); const uri2 = URI.file('c:\\1/2/3'); - assert.equal(uriDisplayService.getLabel(uri2, false), isWindows ? 'C:\\1\\2\\3' : '/c:\\1/2/3'); + assert.equal(uriLabelService.getLabel(uri2, false), isWindows ? 'C:\\1\\2\\3' : '/c:\\1/2/3'); }); test('custom scheme', function () { - uriDisplayService.registerFormater(Schemas.vscode, { + uriLabelService.registerFormater(Schemas.vscode, { label: 'LABEL/${path}/${authority}/END', separator: '/', tildify: true, @@ -45,6 +45,6 @@ suite('URI Display', () => { }); const uri1 = URI.parse('vscode://microsoft.com/1/2/3/4/5'); - assert.equal(uriDisplayService.getLabel(uri1, false), 'LABEL//1/2/3/4/5/microsoft.com/END'); + assert.equal(uriLabelService.getLabel(uri1, false), 'LABEL//1/2/3/4/5/microsoft.com/END'); }); }); diff --git a/src/vs/platform/workspaces/common/workspaces.ts b/src/vs/platform/workspaces/common/workspaces.ts index 3c3f6fe8c40..5c8c389fc85 100644 --- a/src/vs/platform/workspaces/common/workspaces.ts +++ b/src/vs/platform/workspaces/common/workspaces.ts @@ -17,7 +17,7 @@ import { getBaseLabel } from 'vs/base/common/labels'; import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; import URI from 'vs/base/common/uri'; import { Schemas } from 'vs/base/common/network'; -import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; export const IWorkspacesMainService = createDecorator('workspacesMainService'); export const IWorkspacesService = createDecorator('workspacesService'); @@ -113,17 +113,17 @@ export interface IWorkspacesService { createWorkspace(folders?: IWorkspaceFolderCreationData[]): TPromise; } -export function getWorkspaceLabel(workspace: (IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier), environmentService: IEnvironmentService, uriDisplayService: IUriDisplayService, options?: { verbose: boolean }): string { +export function getWorkspaceLabel(workspace: (IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier), environmentService: IEnvironmentService, uriLabelService: IUriLabelService, options?: { verbose: boolean }): string { // Workspace: Single Folder if (isSingleFolderWorkspaceIdentifier(workspace)) { // Folder on disk if (workspace.scheme === Schemas.file) { - return options && options.verbose ? uriDisplayService.getLabel(workspace) : getBaseLabel(workspace); + return options && options.verbose ? uriLabelService.getLabel(workspace) : getBaseLabel(workspace); } // Remote folder - return options && options.verbose ? uriDisplayService.getLabel(workspace) : `${getBaseLabel(workspace)} (${workspace.scheme})`; + return options && options.verbose ? uriLabelService.getLabel(workspace) : `${getBaseLabel(workspace)} (${workspace.scheme})`; } // Workspace: Untitled @@ -135,7 +135,7 @@ export function getWorkspaceLabel(workspace: (IWorkspaceIdentifier | ISingleFold 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)", uriDisplayService.getLabel(URI.file(join(dirname(workspace.configPath), workspaceName)))); + return localize('workspaceNameVerbose', "{0} (Workspace)", uriLabelService.getLabel(URI.file(join(dirname(workspace.configPath), workspaceName)))); } return localize('workspaceName', "{0} (Workspace)", workspaceName); diff --git a/src/vs/workbench/api/electron-browser/mainThreadFileSystem.ts b/src/vs/workbench/api/electron-browser/mainThreadFileSystem.ts index 691841b18de..164d458a3ed 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 { UriDisplayRules, IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { UriLabelRules, IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; @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, - @IUriDisplayService private readonly _uriDisplayService: IUriDisplayService + @IUriLabelService private readonly _uriLabelService: IUriLabelService ) { this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostFileSystem); } @@ -41,8 +41,8 @@ export class MainThreadFileSystem implements MainThreadFileSystemShape { this._fileProvider.delete(handle); } - $setUriFormatter(scheme: string, formatter: UriDisplayRules): void { - this._uriDisplayService.registerFormater(scheme, formatter); + $setUriFormatter(scheme: string, formatter: UriLabelRules): void { + this._uriLabelService.registerFormater(scheme, formatter); } $onFileSystemChange(handle: number, changes: IFileChangeDto[]): void { diff --git a/src/vs/workbench/api/node/extHost.protocol.ts b/src/vs/workbench/api/node/extHost.protocol.ts index 575bb71cb4b..edb764542ad 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 { UriDisplayRules } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { UriLabelRules } from 'vs/platform/uriLabel/common/uriLabel'; import * as vscode from 'vscode'; export interface IEnvironment { @@ -483,7 +483,7 @@ export interface IFileChangeDto { export interface MainThreadFileSystemShape extends IDisposable { $registerFileSystemProvider(handle: number, scheme: string, capabilities: FileSystemProviderCapabilities): void; $unregisterProvider(handle: number): void; - $setUriFormatter(scheme: string, formatter: UriDisplayRules): void; + $setUriFormatter(scheme: string, formatter: UriLabelRules): void; $onFileSystemChange(handle: number, resource: IFileChangeDto[]): void; } diff --git a/src/vs/workbench/api/node/extHostFileSystem.ts b/src/vs/workbench/api/node/extHostFileSystem.ts index c39ffb2a3f9..732d21cd761 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 { UriDisplayRules } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { UriLabelRules } from 'vs/platform/uriLabel/common/uriLabel'; class FsLinkProvider implements vscode.DocumentLinkProvider { @@ -142,7 +142,7 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape { }); } - setUriFormatter(scheme: string, formatter: UriDisplayRules): void { + setUriFormatter(scheme: string, formatter: UriLabelRules): void { this._proxy.$setUriFormatter(scheme, formatter); } diff --git a/src/vs/workbench/browser/actions/workspaceCommands.ts b/src/vs/workbench/browser/actions/workspaceCommands.ts index 955717730e0..055f30bd49d 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 { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; 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 uriDisplayService = accessor.get(IUriDisplayService); + const uriLabelService = accessor.get(IUriLabelService); 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: uriDisplayService.getLabel(resources.dirname(folder.uri), true), + description: uriLabelService.getLabel(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 bf04e217fa7..7a1b6e0aedc 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 { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; 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, - @IUriDisplayService protected uriDisplayService: IUriDisplayService + @IUriLabelService protected uriLabelService: IUriLabelService ) { 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.uriDisplayService.getLabel(resource); + this.computedPathLabel = this.uriLabelService.getLabel(resource); } iconLabelOptions.title = this.computedPathLabel; @@ -274,9 +274,9 @@ export class FileLabel extends ResourceLabel { @IDecorationsService decorationsService: IDecorationsService, @IThemeService themeService: IThemeService, @IUntitledEditorService private untitledEditorService: IUntitledEditorService, - @IUriDisplayService uriDisplayService: IUriDisplayService + @IUriLabelService uriLabelService: IUriLabelService ) { - super(container, options, extensionService, configurationService, modeService, modelService, decorationsService, themeService, uriDisplayService); + super(container, options, extensionService, configurationService, modeService, modelService, decorationsService, themeService, uriLabelService); } 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.uriDisplayService.getLabel(resources.dirname(resource), true); + description = this.uriLabelService.getLabel(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 9b5dd21bd15..428a391e24b 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 { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; 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, - @IUriDisplayService uriDisplayService: IUriDisplayService, + @IUriLabelService uriLabelService: IUriLabelService, @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 = uriDisplayService.getLabel(resources.dirname(this.resource), true); + this.description = uriLabelService.getLabel(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 78a6928f254..d383476fbd5 100644 --- a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts +++ b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts @@ -30,7 +30,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment' 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 { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; 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 { @IKeybindingService private keybindingService: IKeybindingService, @IConfigurationService private configurationService: IConfigurationService, @IEnvironmentService private environmentService: IEnvironmentService, - @IUriDisplayService private uriDisplayService: IUriDisplayService, + @IUriLabelService private uriLabelService: IUriLabelService, @IUpdateService private updateService: IUpdateService ) { @@ -507,14 +507,14 @@ export class MenubarControl extends Disposable { let uri: URI; if (isSingleFolderWorkspaceIdentifier(workspace) && !isFile) { - label = getWorkspaceLabel(workspace, this.environmentService, this.uriDisplayService, { verbose: true }); + label = getWorkspaceLabel(workspace, this.environmentService, this.uriLabelService, { verbose: true }); uri = workspace; } else if (isWorkspaceIdentifier(workspace)) { - label = getWorkspaceLabel(workspace, this.environmentService, this.uriDisplayService, { verbose: true }); + label = getWorkspaceLabel(workspace, this.environmentService, this.uriLabelService, { verbose: true }); uri = URI.file(workspace.configPath); } else { uri = workspace; - label = this.uriDisplayService.getLabel(uri); + label = this.uriLabelService.getLabel(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 84702f9de77..9a4bc78f8bf 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 { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; 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, - @IUriDisplayService private uriDisplayService: IUriDisplayService + @IUriLabelService private uriLabelService: IUriLabelService ) { super(id, { hasTitle: false }, themeService); @@ -244,9 +244,9 @@ export class TitlebarPart extends Part implements ITitleService { const activeEditorMedium = editor ? editor.getTitle(Verbosity.MEDIUM) : activeEditorShort; const activeEditorLong = editor ? editor.getTitle(Verbosity.LONG) : activeEditorMedium; const rootName = workspace.name; - const rootPath = root ? this.uriDisplayService.getLabel(root) : ''; + const rootPath = root ? this.uriLabelService.getLabel(root) : ''; const folderName = folder ? folder.name : ''; - const folderPath = folder ? this.uriDisplayService.getLabel(folder.uri) : ''; + const folderPath = folder ? this.uriLabelService.getLabel(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 27d9f0d2cdd..93d3f05fdec 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 { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; /** * 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, - @IUriDisplayService private uriDisplayService: IUriDisplayService + @IUriLabelService private uriLabelService: IUriLabelService ) { super(); @@ -79,17 +79,17 @@ export class UntitledEditorInput extends EditorInput implements IEncodingSupport @memoize private get shortDescription(): string { - return paths.basename(this.uriDisplayService.getLabel(resources.dirname(this.resource))); + return paths.basename(this.uriLabelService.getLabel(resources.dirname(this.resource))); } @memoize private get mediumDescription(): string { - return this.uriDisplayService.getLabel(resources.dirname(this.resource), true); + return this.uriLabelService.getLabel(resources.dirname(this.resource), true); } @memoize private get longDescription(): string { - return this.uriDisplayService.getLabel(resources.dirname(this.resource)); + return this.uriLabelService.getLabel(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.uriDisplayService.getLabel(this.resource, true); + return this.uriLabelService.getLabel(this.resource, true); } @memoize private get longTitle(): string { - return this.uriDisplayService.getLabel(this.resource); + return this.uriLabelService.getLabel(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 91c474950c1..5c5efee9c6c 100644 --- a/src/vs/workbench/electron-browser/actions.ts +++ b/src/vs/workbench/electron-browser/actions.ts @@ -46,7 +46,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 { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; import { dirname } from 'vs/base/common/resources'; import { IModelService } from 'vs/editor/common/services/modelService'; import { IModeService } from 'vs/editor/common/services/modeService'; @@ -700,7 +700,7 @@ export abstract class BaseOpenRecentAction extends Action { private quickInputService: IQuickInputService, private contextService: IWorkspaceContextService, private environmentService: IEnvironmentService, - private uriDisplayService: IUriDisplayService, + private uriLabelService: IUriLabelService, private keybindingService: IKeybindingService, private modelService: IModelService, private modeService: IModeService, @@ -717,22 +717,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, uriDisplayService: IUriDisplayService, buttons: IQuickInputButton[]) => { + const toPick = (workspace: IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | URI, fileKind: FileKind, environmentService: IEnvironmentService, uriLabelService: IUriLabelService, buttons: IQuickInputButton[]) => { let resource: URI; let label: string; let description: string; if (isSingleFolderWorkspaceIdentifier(workspace) && fileKind !== FileKind.FILE) { resource = workspace; - label = getWorkspaceLabel(workspace, environmentService, uriDisplayService); - description = uriDisplayService.getLabel(dirname(resource)); + label = getWorkspaceLabel(workspace, environmentService, uriLabelService); + description = uriLabelService.getLabel(dirname(resource)); } else if (isWorkspaceIdentifier(workspace)) { resource = URI.file(workspace.configPath); - label = getWorkspaceLabel(workspace, environmentService, uriDisplayService); - description = uriDisplayService.getLabel(dirname(resource)); + label = getWorkspaceLabel(workspace, environmentService, uriLabelService); + description = uriLabelService.getLabel(dirname(resource)); } else { resource = workspace; label = getBaseLabel(workspace); - description = uriDisplayService.getLabel(dirname(resource)); + description = uriLabelService.getLabel(dirname(resource)); } return { @@ -751,8 +751,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.uriDisplayService, !this.isQuickNavigate() ? [this.removeFromRecentlyOpened] : void 0)); - const filePicks = recentFiles.map(p => toPick(p, FileKind.FILE, this.environmentService, this.uriDisplayService, !this.isQuickNavigate() ? [this.removeFromRecentlyOpened] : void 0)); + 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)); // focus second entry if the first recent workspace is the current workspace let autoFocusSecondEntry: boolean = recentWorkspaces[0] && this.contextService.isCurrentWorkspace(recentWorkspaces[0]); @@ -800,9 +800,9 @@ export class OpenRecentAction extends BaseOpenRecentAction { @IKeybindingService keybindingService: IKeybindingService, @IModelService modelService: IModelService, @IModeService modeService: IModeService, - @IUriDisplayService uriDisplayService: IUriDisplayService + @IUriLabelService uriLabelService: IUriLabelService ) { - super(id, label, windowService, windowsService, quickInputService, contextService, environmentService, uriDisplayService, keybindingService, modelService, modeService); + super(id, label, windowService, windowsService, quickInputService, contextService, environmentService, uriLabelService, keybindingService, modelService, modeService); } protected isQuickNavigate(): boolean { @@ -826,9 +826,9 @@ export class QuickOpenRecentAction extends BaseOpenRecentAction { @IKeybindingService keybindingService: IKeybindingService, @IModelService modelService: IModelService, @IModeService modeService: IModeService, - @IUriDisplayService uriDisplayService: IUriDisplayService + @IUriLabelService uriLabelService: IUriLabelService ) { - super(id, label, windowService, windowsService, quickInputService, contextService, environmentService, uriDisplayService, keybindingService, modelService, modeService); + super(id, label, windowService, windowsService, quickInputService, contextService, environmentService, uriLabelService, keybindingService, modelService, modeService); } protected isQuickNavigate(): boolean { @@ -1721,4 +1721,4 @@ export class InspectContextKeysAction extends Action { return TPromise.as(null); } -} \ No newline at end of file +} diff --git a/src/vs/workbench/electron-browser/workbench.ts b/src/vs/workbench/electron-browser/workbench.ts index 61bbd350fa7..443d3f56d8f 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 { IUriDisplayService, UriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService, UriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; interface WorkbenchParams { configuration: IWindowConfiguration; @@ -337,9 +337,9 @@ export class Workbench extends Disposable implements IPartService { serviceCollection.set(IClipboardService, new ClipboardService()); // Uri Display - const uriDisplayService = new UriDisplayService(this.environmentService, this.contextService); - serviceCollection.set(IUriDisplayService, uriDisplayService); - this.configurationService.acquireUriDisplayService(uriDisplayService); + const uriLabelService = new UriLabelService(this.environmentService, this.contextService); + serviceCollection.set(IUriLabelService, uriLabelService); + this.configurationService.acquireUriLabelService(uriLabelService); // 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 be6268a4aa8..3784a56063b 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 { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; 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 5eea47892d2..6f171a925b3 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 { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; /** * 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, - @IUriDisplayService private uriDisplayService: IUriDisplayService + @IUriLabelService private uriLabelService: IUriLabelService ) { super(); @@ -132,17 +132,17 @@ export class FileEditorInput extends EditorInput implements IFileEditorInput { @memoize private get shortDescription(): string { - return paths.basename(this.uriDisplayService.getLabel(resources.dirname(this.resource))); + return paths.basename(this.uriLabelService.getLabel(resources.dirname(this.resource))); } @memoize private get mediumDescription(): string { - return this.uriDisplayService.getLabel(resources.dirname(this.resource), true); + return this.uriLabelService.getLabel(resources.dirname(this.resource), true); } @memoize private get longDescription(): string { - return this.uriDisplayService.getLabel(resources.dirname(this.resource), true); + return this.uriLabelService.getLabel(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.uriDisplayService.getLabel(this.resource, true); + return this.uriLabelService.getLabel(this.resource, true); } @memoize private get longTitle(): string { - return this.uriDisplayService.getLabel(this.resource, true); + return this.uriLabelService.getLabel(this.resource, true); } getTitle(verbosity: Verbosity): string { 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 a34d3ded080..39594b253a5 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 { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; import { Schemas } from 'vs/base/common/network'; import { nativeSep } from 'vs/base/common/paths'; @@ -53,10 +53,10 @@ export class OpenExplorerViewletAction extends ToggleViewletAction { } } -class FileUriDisplayContribution implements IWorkbenchContribution { +class FileUriLabelContribution implements IWorkbenchContribution { - constructor(@IUriDisplayService uriDisplayService: IUriDisplayService) { - uriDisplayService.registerFormater(Schemas.file, { + constructor(@IUriLabelService uriLabelService: IUriLabelService) { + uriLabelService.registerFormater(Schemas.file, { label: '${path}', separator: nativeSep, tildify: !platform.isWindows, @@ -172,7 +172,7 @@ Registry.as(WorkbenchExtensions.Workbench).regi Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DirtyFilesTracker, LifecyclePhase.Starting); // Register uri display for file uris -Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(FileUriDisplayContribution, LifecyclePhase.Starting); +Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(FileUriLabelContribution, LifecyclePhase.Starting); // Configuration diff --git a/src/vs/workbench/parts/localizations/electron-browser/localizationsActions.ts b/src/vs/workbench/parts/localizations/electron-browser/localizationsActions.ts index 2290be2e5d0..3eeb2028a11 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 { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; 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, - @IUriDisplayService private uriDisplayService: IUriDisplayService + @IUriLabelService private uriLabelService: IUriLabelService ) { 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.uriDisplayService.getLabel(file, true), error)); + throw new Error(localize('fail.createSettings', "Unable to create '{0}' ({1}).", this.uriLabelService.getLabel(file, true), error)); }); } } diff --git a/src/vs/workbench/parts/markers/electron-browser/markersTreeViewer.ts b/src/vs/workbench/parts/markers/electron-browser/markersTreeViewer.ts index 133884c00dd..f9549b81f58 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 { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; interface IResourceMarkersTemplateData { resourceLabel: ResourceLabel; @@ -99,7 +99,7 @@ export class Renderer implements IRenderer { private actionItemProvider: IActionItemProvider, @IInstantiationService private instantiationService: IInstantiationService, @IThemeService private themeService: IThemeService, - @IUriDisplayService private uriDisplayService: IUriDisplayService + @IUriLabelService private uriLabelService: IUriLabelService ) { } @@ -208,7 +208,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.uriDisplayService.getLabel(element.uri, true), resource: element.uri }, { matches: element.uriMatches }); + templateData.resourceLabel.setLabel({ name: element.name, description: this.uriLabelService.getLabel(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.uriDisplayService.getLabel(element.raw.resource, true); + templateData.resourceLabel.element.title = this.uriLabelService.getLabel(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; @@ -272,13 +272,13 @@ export class Renderer implements IRenderer { export class MarkersTreeAccessibilityProvider implements IAccessibilityProvider { constructor( - @IUriDisplayService private uriDisplayServie: IUriDisplayService + @IUriLabelService private uriLabelServie: IUriLabelService ) { } public getAriaLabel(tree: ITree, element: any): string { if (element instanceof ResourceMarkers) { - const path = this.uriDisplayServie.getLabel(element.uri, true) || element.uri.fsPath; + const path = this.uriLabelServie.getLabel(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 baf0b860cc8..d504966ecc3 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 { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; 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, - @IUriDisplayService private uriDisplayService: IUriDisplayService + @IUriLabelService private uriLabelService: IUriLabelService ) { 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.uriDisplayService.getLabel(resources.dirname(fileMatch.resource), true); + const description = this.uriLabelService.getLabel(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 17472a73e75..cf6acbc1f1e 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 { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; class SymbolEntry extends EditorQuickOpenEntry { @@ -34,7 +34,7 @@ class SymbolEntry extends EditorQuickOpenEntry { private _provider: IWorkspaceSymbolProvider, @IConfigurationService private readonly _configurationService: IConfigurationService, @IEditorService editorService: IEditorService, - @IUriDisplayService private _uriDisplayService: IUriDisplayService + @IUriLabelService private _uriLabelService: IUriLabelService ) { super(editorService); } @@ -53,7 +53,7 @@ class SymbolEntry extends EditorQuickOpenEntry { if (containerName) { return `${containerName} — ${basename(this._bearing.location.uri.fsPath)}`; } else { - return this._uriDisplayService.getLabel(this._bearing.location.uri, true); + return this._uriLabelService.getLabel(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 4a27ccf12d5..bc1aae507f7 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 { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; export class SearchDataSource implements IDataSource { @@ -318,7 +318,7 @@ export class SearchRenderer extends Disposable implements IRenderer { export class SearchAccessibilityProvider implements IAccessibilityProvider { constructor( - @IUriDisplayService private uriDisplayService: IUriDisplayService + @IUriLabelService private uriLabelService: IUriLabelService ) { } @@ -328,7 +328,7 @@ export class SearchAccessibilityProvider implements IAccessibilityProvider { } if (element instanceof FileMatch) { - const path = this.uriDisplayService.getLabel(element.resource(), true) || element.resource().fsPath; + const path = this.uriLabelService.getLabel(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 c27b1e12bc6..9ad196cfe57 100644 --- a/src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.ts +++ b/src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.ts @@ -40,7 +40,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 { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; used(); @@ -226,7 +226,7 @@ class WelcomePage { @IWorkspaceContextService private contextService: IWorkspaceContextService, @IConfigurationService private configurationService: IConfigurationService, @IEnvironmentService private environmentService: IEnvironmentService, - @IUriDisplayService private uriDisplayService: IUriDisplayService, + @IUriLabelService private uriLabelService: IUriLabelService, @INotificationService private notificationService: INotificationService, @IExtensionEnablementService private extensionEnablementService: IExtensionEnablementService, @IExtensionGalleryService private extensionGalleryService: IExtensionGalleryService, @@ -283,9 +283,9 @@ class WelcomePage { let resource: URI; if (isSingleFolderWorkspaceIdentifier(workspace)) { resource = workspace; - label = getWorkspaceLabel(workspace, this.environmentService, this.uriDisplayService); + label = getWorkspaceLabel(workspace, this.environmentService, this.uriLabelService); } else if (isWorkspaceIdentifier(workspace)) { - label = getWorkspaceLabel(workspace, this.environmentService, this.uriDisplayService); + label = getWorkspaceLabel(workspace, this.environmentService, this.uriLabelService); resource = URI.file(workspace.configPath); } else { label = getBaseLabel(workspace); @@ -307,7 +307,7 @@ class WelcomePage { } parentFolderPath = tildify(parentFolder, this.environmentService.userHome); } else { - parentFolderPath = this.uriDisplayService.getLabel(resource); + parentFolderPath = this.uriLabelService.getLabel(resource); } diff --git a/src/vs/workbench/services/bulkEdit/electron-browser/bulkEditService.ts b/src/vs/workbench/services/bulkEdit/electron-browser/bulkEditService.ts index 7fb340f111a..e120c966d99 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 { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; abstract class Recording { @@ -233,7 +233,7 @@ export class BulkEdit { @ITextModelService private readonly _textModelService: ITextModelService, @IFileService private readonly _fileService: IFileService, @ITextFileService private readonly _textFileService: ITextFileService, - @IUriDisplayService private readonly _uriDisplayServie: IUriDisplayService + @IUriLabelService private readonly _uriLabelServie: IUriLabelService ) { this._editor = editor; this._progress = progress || emptyProgressRunner; @@ -339,7 +339,7 @@ export class BulkEdit { const conflicts = edits .filter(edit => recording.hasChanged(edit.resource)) - .map(edit => this._uriDisplayServie.getLabel(edit.resource, true)); + .map(edit => this._uriLabelServie.getLabel(edit.resource, true)); recording.stop(); @@ -369,7 +369,7 @@ export class BulkEditService implements IBulkEditService { @ITextModelService private readonly _textModelService: ITextModelService, @IFileService private readonly _fileService: IFileService, @ITextFileService private readonly _textFileService: ITextFileService, - @IUriDisplayService private readonly _uriDisplayService: IUriDisplayService + @IUriLabelService private readonly _uriLabelService: IUriLabelService ) { } @@ -400,7 +400,7 @@ export class BulkEditService implements IBulkEditService { } } - const bulkEdit = new BulkEdit(options.editor, options.progress, this._logService, this._textModelService, this._fileService, this._textFileService, this._uriDisplayService); + const bulkEdit = new BulkEdit(options.editor, options.progress, this._logService, this._textModelService, this._fileService, this._textFileService, this._uriLabelService); bulkEdit.add(edits); return TPromise.wrap(bulkEdit.perform().then(() => { diff --git a/src/vs/workbench/services/configuration/node/configurationService.ts b/src/vs/workbench/services/configuration/node/configurationService.ts index 02320795944..e954cacc4e1 100644 --- a/src/vs/workbench/services/configuration/node/configurationService.ts +++ b/src/vs/workbench/services/configuration/node/configurationService.ts @@ -41,7 +41,7 @@ import { UserConfiguration } from 'vs/platform/configuration/node/configuration' import { IJSONSchema, IJSONSchemaMap } from 'vs/base/common/jsonSchema'; import { localize } from 'vs/nls'; import { isEqual, hasToIgnoreCase } from 'vs/base/common/resources'; -import { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; export class WorkspaceService extends Disposable implements IWorkspaceConfigurationService, IWorkspaceContextService { @@ -69,7 +69,7 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat public readonly onDidChangeWorkbenchState: Event = this._onDidChangeWorkbenchState.event; private fileService: IFileService; - private uriDisplayService: IUriDisplayService; + private uriLabelService: IUriLabelService; private configurationEditingService: ConfigurationEditingService; private jsonEditingService: JSONEditingService; @@ -319,8 +319,8 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat }); } - acquireUriDisplayService(uriDisplayService: IUriDisplayService): void { - this.uriDisplayService = uriDisplayService; + acquireUriLabelService(uriLabelService: IUriLabelService): void { + this.uriLabelService = uriLabelService; } acquireInstantiationService(instantiationService: IInstantiationService): void { @@ -346,7 +346,7 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat .then(() => { const workspaceFolders = toWorkspaceFolders(this.workspaceConfiguration.getFolders(), URI.file(dirname(workspaceConfigPath.fsPath))); const workspaceId = workspaceIdentifier.id; - const workspaceName = getWorkspaceLabel({ id: workspaceId, configPath: workspaceConfigPath.fsPath }, this.environmentService, this.uriDisplayService); + const workspaceName = getWorkspaceLabel({ id: workspaceId, configPath: workspaceConfigPath.fsPath }, this.environmentService, this.uriLabelService); return new Workspace(workspaceId, workspaceName, workspaceFolders, workspaceConfigPath); }); } @@ -369,11 +369,11 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat } const id = createHash('md5').update(folder.fsPath).update(ctime ? String(ctime) : '').digest('hex'); - return new Workspace(id, getWorkspaceLabel(folder, this.environmentService, this.uriDisplayService), toWorkspaceFolders([{ path: folder.fsPath }]), null, ctime); + return new Workspace(id, getWorkspaceLabel(folder, this.environmentService, this.uriLabelService), toWorkspaceFolders([{ path: folder.fsPath }]), null, ctime); }); } else { const id = createHash('md5').update(folder.toString()).digest('hex'); - return TPromise.as(new Workspace(id, getWorkspaceLabel(folder, this.environmentService, this.uriDisplayService), toWorkspaceFolders([{ uri: folder.toString() }]), null)); + return TPromise.as(new Workspace(id, getWorkspaceLabel(folder, this.environmentService, this.uriLabelService), toWorkspaceFolders([{ uri: folder.toString() }]), null)); } } diff --git a/src/vs/workbench/services/editor/browser/editorService.ts b/src/vs/workbench/services/editor/browser/editorService.ts index 6250d63c405..32c50e0a867 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 { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; 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, - @IUriDisplayService private uriDisplayService: IUriDisplayService, + @IUriLabelService private uriLabelService: IUriLabelService, @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.uriDisplayService.getLabel(res, true); + return this.uriLabelService.getLabel(res, true); } //#endregion @@ -584,7 +584,7 @@ export class DelegatingEditorService extends EditorService { @IEditorGroupsService editorGroupService: EditorGroupsServiceImpl, @IUntitledEditorService untitledEditorService: IUntitledEditorService, @IInstantiationService instantiationService: IInstantiationService, - @IUriDisplayService uriDisplayService: IUriDisplayService, + @IUriLabelService uriLabelService: IUriLabelService, @IFileService fileService: IFileService, @IConfigurationService configurationService: IConfigurationService ) { @@ -592,7 +592,7 @@ export class DelegatingEditorService extends EditorService { editorGroupService, untitledEditorService, instantiationService, - uriDisplayService, + uriLabelService, fileService, configurationService ); diff --git a/src/vs/workbench/services/preferences/browser/preferencesService.ts b/src/vs/workbench/services/preferences/browser/preferencesService.ts index 1c87721d27a..8954289dfeb 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 { IUriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; const emptyEditableSettingsContent = '{\n}'; @@ -70,7 +70,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic @IModelService private modelService: IModelService, @IJSONEditingService private jsonEditingService: IJSONEditingService, @IModeService private modeService: IModeService, - @IUriDisplayService private uriDisplayService: IUriDisplayService + @IUriLabelService private uriLabelService: IUriLabelService ) { super(); // The default keybindings.json updates based on keyboard layouts, so here we make sure @@ -445,7 +445,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.uriDisplayService.getLabel(resource, true), error))); + return TPromise.wrapError(new Error(nls.localize('fail.createSettings', "Unable to create '{0}' ({1}).", this.uriLabelService.getLabel(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 b9728fac684..55d3113842c 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 { UriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { UriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; suite('MainThreadEditors', () => { @@ -83,7 +83,7 @@ suite('MainThreadEditors', () => { } }; - const bulkEditService = new BulkEditService(new NullLogService(), modelService, new TestEditorService(), textModelService, new TestFileService(), textFileService, new UriDisplayService(TestEnvironmentService, new TestContextService())); + const bulkEditService = new BulkEditService(new NullLogService(), modelService, new TestEditorService(), textModelService, new TestFileService(), textFileService, new UriLabelService(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 f66a8628123..d7155fb2d67 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 { IUriDisplayService, UriDisplayService } from 'vs/platform/uriDisplay/common/uriDisplay'; +import { IUriLabelService, UriLabelService } from 'vs/platform/uriLabel/common/uriLabel'; 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(IUriDisplayService, new UriDisplayService(TestEnvironmentService, workspaceContextService)); + instantiationService.stub(IUriLabelService, new UriLabelService(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 bab2fdcc700..184ccb27ce7 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/uriDisplay/electron-browser/uriDisplay.contribution'; +import 'vs/platform/uriLabel/electron-browser/uriLabel.contribution'; // Menus/Actions import 'vs/workbench/services/actions/electron-browser/menusExtensionPoint';