From 28fd4571e845be96d59bf98a48b3298d8566c2f2 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 14 Jun 2016 09:53:04 +0200 Subject: [PATCH] better handle case of dropped folder to tabs --- .../parts/files/browser/editors/textFileEditor.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/vs/workbench/parts/files/browser/editors/textFileEditor.ts b/src/vs/workbench/parts/files/browser/editors/textFileEditor.ts index 6766f21deac..549a0a40138 100644 --- a/src/vs/workbench/parts/files/browser/editors/textFileEditor.ts +++ b/src/vs/workbench/parts/files/browser/editors/textFileEditor.ts @@ -8,7 +8,6 @@ import {TPromise} from 'vs/base/common/winjs.base'; import nls = require('vs/nls'); import errors = require('vs/base/common/errors'); import {MIME_BINARY, MIME_TEXT} from 'vs/base/common/mime'; -import labels = require('vs/base/common/labels'); import types = require('vs/base/common/types'); import paths = require('vs/base/common/paths'); import {IEditorViewState} from 'vs/editor/common/editorCommon'; @@ -230,13 +229,11 @@ export class TextFileEditor extends BaseTextEditor { private openAsFolder(input: EditorInput): boolean { - // Since we cannot open a folder, we have to restore the previous input if any or close the editor - let handleEditorPromise: TPromise; + // Since we cannot open a folder, we have to restore the previous input if any and close the editor + let handleEditorPromise: TPromise = this.editorService.closeEditor(this.position, this.input); let previousInput = this.historyService.getHistory()[1]; if (previousInput) { - handleEditorPromise = this.editorService.openEditor(previousInput, null, this.position); - } else { - handleEditorPromise = this.editorService.closeEditor(this.position, this.input); + handleEditorPromise = handleEditorPromise.then(() => this.editorService.openEditor(previousInput, null, this.position)); } handleEditorPromise.done(() => { @@ -251,11 +248,6 @@ export class TextFileEditor extends BaseTextEditor { return viewlet.getExplorerView().select(fileEditorInput.getResource(), true); }, errors.onUnexpectedError); } - - // Otherwise inform the user - else { - this.messageService.show(Severity.Info, nls.localize('folderOutofWorkspace', "The folder '{0}' is outside the currently opened root folder and can not be opened in this instance.", labels.getPathLabel(fileEditorInput.getResource()))); - } } }, errors.onUnexpectedError);