Correctly handle creating and saving untitled notebook .dib files. (#18744)

This commit is contained in:
Cory Rivera
2022-03-16 14:37:21 -07:00
committed by GitHub
parent 8cc0fdfdc5
commit 95980130c8
11 changed files with 72 additions and 27 deletions

View File

@@ -224,12 +224,7 @@ export class ExtHostNotebookDocumentsAndEditors implements ExtHostNotebookDocume
//#region Extension accessible methods
async createNotebookDocument(providerId: string, contents?: azdata.nb.INotebookContents): Promise<URI> {
let options: INotebookShowOptions = {};
if (contents) {
options.providerId = providerId;
options.initialContent = JSON.stringify(contents);
}
let uriComps = await this._proxy.$tryCreateNotebookDocument(options);
let uriComps = await this._proxy.$tryCreateNotebookDocument(providerId, contents);
let uri = URI.revive(uriComps);
let notebookCells = contents?.cells?.map<azdata.nb.NotebookCell>(cellContents => {
return {

View File

@@ -1012,7 +1012,7 @@ export interface ExtHostNotebookDocumentsAndEditorsShape {
export interface MainThreadNotebookDocumentsAndEditorsShape extends IDisposable {
$trySetTrusted(_uri: UriComponents, isTrusted: boolean): Thenable<boolean>;
$trySaveDocument(uri: UriComponents): Thenable<boolean>;
$tryCreateNotebookDocument(options: INotebookShowOptions): Promise<UriComponents>;
$tryCreateNotebookDocument(providerId: string, contents?: azdata.nb.INotebookContents): Promise<UriComponents>;
$tryShowNotebookDocument(resource: UriComponents, options: INotebookShowOptions): Promise<string>;
$tryApplyEdits(id: string, modelVersionId: number, edits: INotebookEditOperation[], opts: IUndoStopOptions): Promise<boolean>;
$runCell(id: string, cellUri: UriComponents): Promise<boolean>;