提交 6f9385fb 编写于 作者: B Benjamin Pasero

close file also works on non file editors (fixes #3439)

上级 7e89b382
......@@ -2032,10 +2032,11 @@ export class CloseFileAction extends Action {
}
public run(): TPromise<any> {
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."));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册