Change:
Steps to Reproduce: an untitled editor and make it dirty the editor "Save" from the prompt = the editor is saved but stays open

Discussion:
import 'vs/css!./media/editorgroupview'; import { EditorGroup, IEditorOpenOptions, EditorCloseEvent, ISerializedEditorGroup, isSerializedEditorGroup } from 'vs/workbench/common/editor/editorGroup'; <del> import { EditorInput, EditorOptions, GroupIdentifier, SideBySideEditorInput, CloseDirection, IEditorCloseEvent, EditorGroupActiveEditorDirtyContext, IEditor, EditorGroupEditorsCountContext, toResource, SideBySideEditor, SaveReason } from 'vs/workbench/common/editor'; </del> <ins> import { EditorInput, EditorOptions, GroupIdentifier, SideBySideEditorInput, CloseDirection, IEditorCloseEvent, EditorGroupActiveEditorDirtyContext, IEditor, EditorGroupEditorsCountContext, toResource, SideBySideEditor, SaveReason, SaveContext } from 'vs/workbench/common/editor'; </ins> import { Event, Emitter, Relay } from 'vs/base/common/event'; import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { addClass, addClasses, Dimension, trackFocus, toggleClass, removeClass, addDisposableListener, EventType, EventHelper, findParentWithClass, clearNode, isAncestor } from 'vs/base/browser/dom';

// Otherwise, handle accordingly switch (res) { case ConfirmResult.SAVE: <del> const result = await editor.save(this._group.id, { reason: SaveReason.EXPLICIT }); </del> <ins> const result = await editor.save(this._group.id, { reason: SaveReason.EXPLICIT, context: SaveContext.EDITOR_CLOSE }); </ins> return !result; case ConfirmResult.DONT_SAVE:

WINDOW_CHANGE = 4 } <ins> export const enum SaveContext { /** * Indicates that the editor is saved because it * is being closed by the user. */ EDITOR_CLOSE = 1, } </ins> export interface ISaveOptions { /**

reason?: SaveReason; /** <ins> * Additional information about the context of the save. */ context?: SaveContext; /** </ins> * Forces to load the contents of the working copy * again even if the working copy is not dirty. */

} saveAs(group: GroupIdentifier, options?: ITextFileSaveOptions): Promise<boolean> { <del> return this.doSaveAs(group, () => this.textFileService.saveAs(this.resource, undefined, options)); </del> <ins> return this.doSaveAs(group, options, () => this.textFileService.saveAs(this.resource, undefined, options)); </ins> } <del> protected async doSaveAs(group: GroupIdentifier, saveRunnable: () => Promise<URI | undefined>, replaceAllEditors?: boolean): Promise<boolean> { </del> <ins> protected async doSaveAs(group: GroupIdentifier, options: ISaveOptions | undefined, saveRunnable: () => Promise<URI | undefined>, replaceAllEditors?: boolean): Promise<boolean> { </ins> // Preserve view state by opening the editor first. In addition // this allows the user to review the contents of the editor.

// Replace editor preserving viewstate (either across all groups or // only selected group) if the target is different from the current resource <del> if (!isEqual(target, this.resource)) { </del> <ins> // and if the editor is not being saved because it is being closed // (because in that case we do not want to open a different editor anyway) if (options?.context !== SaveContext.EDITOR_CLOSE && !isEqual(target, this.resource)) { </ins> const replacement = this.editorService.createInput({ resource: target }); const targetGroups = replaceAllEditors ? this.editorGroupService.groups.map(group => group.id) : [group]; for (const group of targetGroups) {

} save(group: GroupIdentifier, options?: ITextFileSaveOptions): Promise<boolean> { <del> return this.doSaveAs(group, async () => { </del> <ins> return this.doSaveAs(group, options, async () => { </ins> // With associated file path, save to the path that is // associated. Make sure to convert the result using

} saveAs(group: GroupIdentifier, options?: ITextFileSaveOptions): Promise<boolean> { <del> return this.doSaveAs(group, () => this.textFileService.saveAs(this.resource, undefined, options), true /* replace editor across all groups */); </del> <ins> return this.doSaveAs(group, options, () => this.textFileService.saveAs(this.resource, undefined, options), true /* replace editor across all groups */); </ins> } async revert(options?: IRevertOptions): Promise<boolean> {