diff --git a/src/vs/workbench/common/editor/diffEditorInput.ts b/src/vs/workbench/common/editor/diffEditorInput.ts index 8e01b6cb032..cca9e3e4577 100644 --- a/src/vs/workbench/common/editor/diffEditorInput.ts +++ b/src/vs/workbench/common/editor/diffEditorInput.ts @@ -4,10 +4,7 @@ *--------------------------------------------------------------------------------------------*/ 'use strict'; -import nls = require('vs/nls'); import { TPromise } from 'vs/base/common/winjs.base'; -import URI from 'vs/base/common/uri'; -import { getPathLabel, IWorkspaceProvider } from 'vs/base/common/labels'; import { EditorModel, EditorInput, SideBySideEditorInput, TEXT_DIFF_EDITOR_ID, BINARY_DIFF_EDITOR_ID } from 'vs/workbench/common/editor'; import { BaseTextEditorModel } from 'vs/workbench/common/editor/textEditorModel'; import { DiffEditorModel } from 'vs/workbench/common/editor/diffEditorModel'; @@ -100,11 +97,4 @@ export class DiffEditorInput extends SideBySideEditorInput { } super.dispose(); } -} - -export function toDiffLabel(res1: URI, res2: URI, context: IWorkspaceProvider): string { - const leftName = getPathLabel(res1.fsPath, context); - const rightName = getPathLabel(res2.fsPath, context); - - return nls.localize('compareLabels', "{0} ↔ {1}", leftName, rightName); } \ No newline at end of file diff --git a/src/vs/workbench/services/editor/browser/editorService.ts b/src/vs/workbench/services/editor/browser/editorService.ts index ddffd5c9502..0af3f86714b 100644 --- a/src/vs/workbench/services/editor/browser/editorService.ts +++ b/src/vs/workbench/services/editor/browser/editorService.ts @@ -18,8 +18,10 @@ import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/edi import { IEditorInput, IEditorOptions, ITextEditorOptions, Position, Direction, IEditor, IResourceInput, IResourceDiffInput, IResourceSideBySideInput } from 'vs/platform/editor/common/editor'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { AsyncDescriptor0 } from 'vs/platform/instantiation/common/descriptors'; -import { DiffEditorInput, toDiffLabel } from 'vs/workbench/common/editor/diffEditorInput'; +import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; +import nls = require('vs/nls'); +import { getPathLabel, IWorkspaceProvider } from 'vs/base/common/labels'; export interface IEditorPart { openEditor(input?: IEditorInput, options?: IEditorOptions | ITextEditorOptions, sideBySide?: boolean): TPromise; @@ -240,10 +242,12 @@ export class WorkbenchEditorService implements IWorkbenchEditorService { // Treat an URI as ResourceEditorInput else if (resourceInput.resource instanceof URI) { - return TPromise.as(this.instantiationService.createInstance(ResourceEditorInput, - basename(resourceInput.resource.fsPath), - dirname(resourceInput.resource.fsPath), - resourceInput.resource)); + return TPromise.as(this.instantiationService.createInstance( + ResourceEditorInput, + resourceInput.label || basename(resourceInput.resource.fsPath), + resourceInput.description || dirname(resourceInput.resource.fsPath), + resourceInput.resource + )); } return TPromise.as(null); @@ -259,6 +263,13 @@ export class WorkbenchEditorService implements IWorkbenchEditorService { } } +function toDiffLabel(res1: URI, res2: URI, context: IWorkspaceProvider): string { + const leftName = getPathLabel(res1.fsPath, context); + const rightName = getPathLabel(res2.fsPath, context); + + return nls.localize('compareLabels', "{0} ↔ {1}", leftName, rightName); +} + export interface IDelegatingWorkbenchEditorServiceHandler { (input: IEditorInput, options?: EditorOptions, sideBySide?: boolean): TPromise; (input: IEditorInput, options?: EditorOptions, position?: Position): TPromise;