From 2316aa0b7f52af6ba6a9863c3205f8e981aedb36 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 21 Dec 2016 15:02:24 +0100 Subject: [PATCH] more use of resource inputs --- .../preferences/browser/preferencesService.ts | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/vs/workbench/parts/preferences/browser/preferencesService.ts b/src/vs/workbench/parts/preferences/browser/preferencesService.ts index 96e9448083a..80c6fac5697 100644 --- a/src/vs/workbench/parts/preferences/browser/preferencesService.ts +++ b/src/vs/workbench/parts/preferences/browser/preferencesService.ts @@ -135,8 +135,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic openGlobalKeybindingSettings(): TPromise { const emptyContents = '// ' + nls.localize('emptyKeybindingsHeader', "Place your key bindings in this file to overwrite the defaults") + '\n[\n]'; - return this.editorService.createInput({ resource: PreferencesService.DEFAULT_KEY_BINDINGS_URI }) - .then(leftHandInput => this.openTwoEditors(leftHandInput, URI.file(this.environmentService.appKeybindingsPath), emptyContents)).then(() => null); + return this.openTwoEditors(PreferencesService.DEFAULT_KEY_BINDINGS_URI, URI.file(this.environmentService.appKeybindingsPath), emptyContents).then(() => null); } private openEditableSettings(configurationTarget: ConfigurationTarget): TPromise { @@ -203,9 +202,7 @@ export class PreferencesService extends Disposable implements IPreferencesServic switch (choice) { case 0: const editorCount = this.editorService.getVisibleEditors().length; - return this.editorService.createInput({ resource: this.contextService.toResource(WORKSPACE_CONFIG_DEFAULT_PATH) }).then(typedInput => { - return this.editorService.openEditor(typedInput, { pinned: true }, editorCount === 2 ? Position.THREE : editorCount === 1 ? Position.TWO : void 0); - }); + return this.editorService.openEditor({ resource: this.contextService.toResource(WORKSPACE_CONFIG_DEFAULT_PATH), options: { pinned: true } }, editorCount === 2 ? Position.THREE : editorCount === 1 ? Position.TWO : void 0); case 1: this.storageService.store(SETTINGS_INFO_IGNORE_KEY, true, StorageScope.WORKSPACE); default: @@ -250,17 +247,14 @@ export class PreferencesService extends Disposable implements IPreferencesServic }); } - private openTwoEditors(leftHandDefaultInput: EditorInput, editableResource: URI, defaultEditableContents: string): TPromise { + private openTwoEditors(leftHandDefault: URI, editableResource: URI, defaultEditableContents: string): TPromise { // Create as needed and open in editor return this.createIfNotExists(editableResource, defaultEditableContents).then(() => { - return this.editorService.createInput({ resource: editableResource }).then(typedRightHandEditableInput => { - const editors = [ - { input: leftHandDefaultInput, position: Position.ONE, options: { pinned: true } }, - { input: typedRightHandEditableInput, position: Position.TWO, options: { pinned: true } } - ]; - return this.editorService.openEditors(editors).then(result => { - this.editorGroupService.focusGroup(Position.TWO); - }); + return this.editorService.openEditors([ + { input: { resource: leftHandDefault, options: { pinned: true } }, position: Position.ONE }, + { input: { resource: editableResource, options: { pinned: true } }, position: Position.TWO }, + ]).then(() => { + this.editorGroupService.focusGroup(Position.TWO); }); }); } -- GitLab