Skip to content

Commit

Permalink
fix #107146.
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornix committed Sep 23, 2020
1 parent 8d056ce commit f943318
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/vs/workbench/contrib/notebook/browser/diff/cellComponents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,22 @@ abstract class AbstractCellRenderer extends Disposable {
}

protected _getFormatedMetadataJSON(metadata: NotebookCellMetadata, language?: string) {
const filteredMetadata: { [key: string]: any } = metadata;
let filteredMetadata: { [key: string]: any } = {};

if (this.notebookEditor.textModel) {
const transientMetadata = this.notebookEditor.textModel!.transientOptions.transientMetadata;

const keys = new Set([...Object.keys(metadata)]);
for (let key of keys) {
if (!(transientMetadata[key as keyof NotebookCellMetadata])
) {
filteredMetadata[key] = metadata[key as keyof NotebookCellMetadata];
}
}
} else {
filteredMetadata = metadata;
}

const content = JSON.stringify({
language,
...filteredMetadata
Expand Down

0 comments on commit f943318

Please sign in to comment.