mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-07 07:35:00 +01:00
close file also works on non file editors (fixes #3439)
This commit is contained in:
@@ -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."));
|
||||
|
||||
Reference in New Issue
Block a user