Mark that notebook metadata is readonly (#158960)

Mark that metadata is `readonly`

Fixes #158955

We freeze the object here 0656d21d11/src/vs/workbench/api/common/extHostNotebookDocument.ts (L70)
This commit is contained in:
Matt Bierner 2022-08-23 14:52:00 -07:00 committed by GitHub
parent b72671133b
commit f00fde0f24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -124,7 +124,7 @@ function encodeBase64(buffer: Uint8Array, padded = true, urlSafe = false) {
}
function buildMetadata(b64: string, cell: vscode.NotebookCell, filename: string, filetype: string, startingAttachments: any): { [key: string]: any } {
const outputMetadata: { [key: string]: any } = cell.metadata;
const outputMetadata = { ...cell.metadata };
const customField = cell.metadata.custom;
if (!customField) {
return { 'custom': { 'attachments': { [filename]: { 'image/png': b64 } } } };

View file

@ -13025,7 +13025,7 @@ declare module 'vscode' {
/**
* The metadata of this cell. Can be anything but must be JSON-stringifyable.
*/
readonly metadata: { [key: string]: any };
readonly metadata: { readonly [key: string]: any };
/**
* The outputs of this cell.