Change:
Testing a new notebook and make an edit profiles to restart the EH the file when prompted and provide a file name: The untitled-n.ipynb tab remains open, rather than opening , :bug: The file is no longer marked dirty, even with futher edits and can be closed without prompting to save
can you maybe check from the notebook side?
Luna paint behaves similarly with one extra step: a new image and make an edit profiles to restart the EH the file when prompted and provide a file name: The untitled-n.ipynb tab remains open, rather than opening , (different) and the switch profile operation is blocked switch profiles again The file is no longer marked dirty, even with futher edits and can be closed without prompting to save
Somehow today I cannot reproduce an issue with insiders: ! Please give me more detailed steps and see if you still find this.
still seeing it. Did you try making edits after switching? that's when the dirty indicator doesn't show up anymore. ! I saved as a different filename in the gif, but keeping the untitled filename still doesn't show a dirty indicator, nor does it auto-save.
This seems to me like something notebooks need to handle better: if you enter an extension host that does not have the notebook extension and you make edits, the editor should probably not allow that. I.e. the editor should maybe turn readonly once the extension is disabled or not present.
- the notebook extension is built-in so it's still available in an empty profile. The repro steps can even start with an empty profile -and make an edit to the first cell profile to default and save as 1.ipynb when prompted an edit in the notebook :bug: file is not dirty
oh nice, sounds like an issue related to EH restart then, will update the title With your working copy knowledge you might be even able to figure this out ;)
It looks like the issue in the notebook scenario is that it's calling save directly on the workingCopy in the : In the untitled case, that will delegate to saveAs, which will dispose the untitled workingcopy without opening a new editor with the resulting . The editor is left open with its underlying WorkingCopy disposed. For non-built-in custom editors though, it seems like we should just close them if we don't know if they will be supported in the new profile. I don't see how we can expect a custom editor to support a scenario where its source extension isn't installed - is that even possible? I went over the issue with and concluded that we can defer to next release since the previous stable version also didn't handle this scenario well.
fyi I just created which is a similar issue for custom editors. Here for notebooks I suggest the following: if the EH restarts and still has the notebook extension for the opened notebooks, reconnect to the EH and allow to further make edits on the editor (I actually thought this was already implemented based on the work did) if the EH restarts and there is no more extension for the notebook editor, turn the notebook readonly and inform the user somehow Does that make sense?
The previous change just doesn't account for untitled notebooks, but I think I can fix that. That makes sense, although I'm surprised that we would require all custom editors to handle this (asked about it in the other issue)

Discussion:
import { NotebookProviderInfo } from 'vs/workbench/contrib/notebook/common/notebookProvider'; import { NotebookPerfMarks } from 'vs/workbench/contrib/notebook/common/notebookPerformance'; import { IFilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService'; <ins> import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { localize } from 'vs/nls'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; </ins> export interface NotebookEditorInputOptions { startDirty?: boolean;

@IInstantiationService private readonly _instantiationService: IInstantiationService, @ILabelService labelService: ILabelService, @IFileService fileService: IFileService, <del> @IFilesConfigurationService filesConfigurationService: IFilesConfigurationService </del> <ins> @IFilesConfigurationService filesConfigurationService: IFilesConfigurationService, @IExtensionService extensionService: IExtensionService, @IEditorService editorService: IEditorService </ins> ) { super(resource, undefined, labelService, fileService, filesConfigurationService); this._defaultDirtyState = !!options.startDirty;

this.resolve().catch(onUnexpectedError); } }); <ins> this._register(extensionService.onWillStop(e => { if (!this.isDirty()) { return; } e.veto((async () => { const editors = editorService.findEditors(this); if (editors.length > 0) { const result = await editorService.save(editors[0]); if (result.success) { return false; // Don't Veto } } return true; // Veto })(), localize('vetoExtHostRestart', "Notebook '{0}' could not be saved.", this.resource.path)); })); </ins> } override dispose() {

import { filter } from 'vs/base/common/objects'; import { assertType } from 'vs/base/common/types'; import { URI } from 'vs/base/common/uri'; <del> import { localize } from 'vs/nls'; </del> import { IRevertOptions, ISaveOptions, IUntypedEditorInput } from 'vs/workbench/common/editor'; import { EditorModel } from 'vs/workbench/common/editor/editorModel'; import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel'; import { ICellDto2, INotebookEditorModel, INotebookLoadOptions, IResolvedNotebookEditorModel, NotebookCellsChangeType, NotebookData } from 'vs/workbench/contrib/notebook/common/notebookCommon'; import { INotebookSerializer, INotebookService, SimpleNotebookProviderInfo } from 'vs/workbench/contrib/notebook/common/notebookService'; <del> import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; </del> import { IFilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService'; import { ILifecycleService } from 'vs/workbench/services/lifecycle/common/lifecycle'; import { IFileWorkingCopyManager } from 'vs/workbench/services/workingCopy/common/fileWorkingCopyManager';

readonly viewType: string, private readonly _workingCopyManager: IFileWorkingCopyManager<NotebookFileWorkingCopyModel, NotebookFileWorkingCopyModel>, @ILifecycleService lifecycleService: ILifecycleService, <del> @IFilesConfigurationService private readonly _filesConfigurationService: IFilesConfigurationService, @IExtensionService extensionService: IExtensionService </del> <ins> @IFilesConfigurationService private readonly _filesConfigurationService: IFilesConfigurationService </ins> ) { super(); if (this.viewType === 'interactive') { lifecycleService.onBeforeShutdown(async e => e.veto(this.onBeforeShutdown(), 'veto.InteractiveWindow')); } <del> this._register(extensionService.onWillStop(e => { if (!this.isDirty()) { return; } e.veto((async () => { const didSave = await this._workingCopy?.save(); if (!didSave) { // Veto return true; } return false; // Don't veto })(), localize('vetoExtHostRestart', "Notebook '{0}' could not be saved.", this._workingCopy?.name)); })); </del> } private async onBeforeShutdown() {