提交 17417865 编写于 作者: R rebornix

show language info in metadata

上级 643318fe
...@@ -220,8 +220,12 @@ abstract class AbstractCellRenderer extends Disposable { ...@@ -220,8 +220,12 @@ abstract class AbstractCellRenderer extends Disposable {
this._updateFoldingIcon(); this._updateFoldingIcon();
} }
private _getFormatedJSON(metadata: NotebookCellMetadata) { private _getFormatedJSON(metadata: NotebookCellMetadata, language?: string) {
const content = JSON.stringify(metadata); const content = JSON.stringify({
language,
...metadata
});
const edits = format(content, undefined, {}); const edits = format(content, undefined, {});
const metadataSource = applyEdits(content, edits); const metadataSource = applyEdits(content, edits);
...@@ -230,8 +234,8 @@ abstract class AbstractCellRenderer extends Disposable { ...@@ -230,8 +234,8 @@ abstract class AbstractCellRenderer extends Disposable {
private _buildMetadataEditor() { private _buildMetadataEditor() {
if (this.cell.type === 'modified') { if (this.cell.type === 'modified') {
const originalMetadataSource = this._getFormatedJSON(this.cell.original?.metadata || {}); const originalMetadataSource = this._getFormatedJSON(this.cell.original?.metadata || {}, this.cell.original?.language);
const modifiedMetadataSource = this._getFormatedJSON(this.cell.modified?.metadata || {}); const modifiedMetadataSource = this._getFormatedJSON(this.cell.modified?.metadata || {}, this.cell.modified?.language);
if (originalMetadataSource !== modifiedMetadataSource) { if (originalMetadataSource !== modifiedMetadataSource) {
this._metadataEditor = this.instantiationService.createInstance(DiffEditorWidget, this._metadataEditorContainer!, { this._metadataEditor = this.instantiationService.createInstance(DiffEditorWidget, this._metadataEditorContainer!, {
...fixedDiffEditorOptions ...fixedDiffEditorOptions
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册