This commit is contained in:
Benjamin Pasero
2016-12-21 15:15:36 +01:00
parent 7d213a5212
commit 42e4f0dc9d
2 changed files with 16 additions and 15 deletions
@@ -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);
}
@@ -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<BaseEditor>;
@@ -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<EditorInput>(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<BaseEditor>;
(input: IEditorInput, options?: EditorOptions, position?: Position): TPromise<BaseEditor>;