diff --git a/src/vs/workbench/parts/files/browser/fileActions.ts b/src/vs/workbench/parts/files/browser/fileActions.ts index 6a65867e237..a78d65ad1b7 100644 --- a/src/vs/workbench/parts/files/browser/fileActions.ts +++ b/src/vs/workbench/parts/files/browser/fileActions.ts @@ -2032,10 +2032,11 @@ export class CloseFileAction extends Action { } public run(): TPromise { + let editor = this.editorService.getActiveEditor(); let input = this.editorService.getActiveEditorInput(); let resource = workbenchEditorCommon.getUntitledOrFileResource(input, true); - // Only works if we have a file or untitled input + // For a file or untitled if (resource) { let model = this.textFileService.getWorkingFilesModel(); let entry = model.findEntry(resource); @@ -2068,6 +2069,11 @@ export class CloseFileAction extends Action { } } + // Any other editor just closes + else if (editor) { + this.editorService.closeEditor(editor).done(null, errors.onUnexpectedError);; + } + // Otherwise tell the user else { this.messageService.show(Severity.Info, nls.localize('noFileOpen', "There is currently no file opened to close."));