Change:
<!-- Do Not Delete This! bugreporttemplate --<!-- Please read our Rules of Conduct: --<!-- Please search existing issues to avoid creating duplicates. --<!-- Also please test using the latest insiders build to make sure your issue has not already been fixed: --<!-- Use Help Report Issue to prefill these. --- Version: 1.46.0-insider Commit: Date: 2020-06-01T10:32:27.369Z Electron: 7.3.0 Chrome: 78.0.3904.130 12.8.1 V8: 7.8.279.23-electron.0 OS: Darwin x64 19.5.0 Steps to Reproduce: a new untitled notebook (using VS Code Python extension) you add a cell or the like, then VSC will invoke the save method on the Problems Adding cells should not invoke save (this happens when user has auto save turned on) Errors thrown in the method are ignored. VSC will assume the notebook was saved and mark it as not dirty (the dirty indicator doesn't exist on the tab anymore) I don't think VSCode should call the method for untitled notebooks. FYI - We create untitled notebooks with a scehme . If this isn't the way to indicate an untitled file (scheme), we might need some API or the like in the notebooks implememtation. /cc
Good catch, untitled file should not trigger save until users explicitly run Save, which will invoke SaveAs.
We should also improve the overall experience for creating untitled notebook documents, they can be created in two approaches: Users press cmd/ctrl+n to create an untitled file, switch to another view type (tracked in ) Users run a specific command to quickly create a notebook untitled file. command should take view type as arguments. cc we may also want to adopt this in Custom Editor world.
We now support opening a untitled file with specified editor view type through the existing new untitled file command (in master, and tomorrow's Insiders) When the command is executed, is invoked with an URI with scheme. is invoked only when users save so no auto save for untitled files as usual.

Discussion:
return this._textModel.object.isDirty(); } <ins> isUntitled(): boolean { return this.textModel?.isUntitled() || false; } </ins> isReadonly() { return false; }

readonly viewType: string; readonly notebook: NotebookTextModel; isDirty(): boolean; <ins> isUntitled(): boolean; </ins> save(): Promise<boolean>; saveAs(target: URI): Promise<boolean>; revert(options?: IRevertOptions | undefined): Promise<void>;

import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel'; import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService'; import { URI } from 'vs/base/common/uri'; <del> import { IWorkingCopyService, IWorkingCopy, IWorkingCopyBackup } from 'vs/workbench/services/workingCopy/common/workingCopyService'; </del> <ins> import { IWorkingCopyService, IWorkingCopy, IWorkingCopyBackup, WorkingCopyCapabilities } from 'vs/workbench/services/workingCopy/common/workingCopyService'; </ins> import { basename } from 'vs/base/common/resources'; import { CancellationTokenSource } from 'vs/base/common/cancellation'; import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';

const workingCopyAdapter = new class implements IWorkingCopy { readonly resource = input._workingCopyResource; get name() { return input.name; } <del> readonly capabilities = input.capabilities; </del> <ins> readonly capabilities = input.isUntitled() ? WorkingCopyCapabilities.Untitled : input.capabilities; </ins> readonly onDidChangeDirty = input.onDidChangeDirty; readonly onDidChangeContent = input.onDidChangeContent; isDirty(): boolean { return input.isDirty(); }

return this._dirty; } <ins> isUntitled() { return this.resource.scheme === Schemas.untitled; } </ins> async save(): Promise<boolean> { const tokenSource = new CancellationTokenSource(); await this.notebookService.save(this.notebook.viewType, this.notebook.uri, tokenSource.token);

import { Webview } from 'vs/workbench/contrib/webview/browser/webview'; import { ICompositeCodeEditor, IEditor } from 'vs/editor/common/editorCommon'; import { NotImplementedError } from 'vs/base/common/errors'; <ins> import { Schemas } from 'vs/base/common/network'; </ins> export class TestCell extends NotebookCellTextModel { constructor(

return this._dirty; } <ins> isUntitled() { return this._notebook.uri.scheme === Schemas.untitled; } </ins> getNotebook(): NotebookTextModel { return this._notebook; }