Skip to content

Commit 1a58734

Browse files
authored
Re microsoft#172417. Clear output rendered by previously picked renderer. (microsoft#172566)
1 parent 40b8a2d commit 1a58734

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2630,11 +2630,14 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditorD
26302630
const existingOutput = this._webview.insetMapping.get(output.source);
26312631
if (!existingOutput
26322632
|| (!existingOutput.renderer && output.type === RenderOutputType.Extension)
2633-
|| (existingOutput.renderer
2634-
&& output.type === RenderOutputType.Extension
2635-
&& existingOutput.renderer.id !== output.renderer.id)
26362633
) {
26372634
this._webview.createOutput({ cellId: cell.id, cellHandle: cell.handle, cellUri: cell.uri }, output, cellTop, offset);
2635+
} else if (existingOutput.renderer
2636+
&& output.type === RenderOutputType.Extension
2637+
&& existingOutput.renderer.id !== output.renderer.id) {
2638+
// switch mimetype
2639+
this._webview.removeInsets([output.source]);
2640+
this._webview.createOutput({ cellId: cell.id, cellHandle: cell.handle, cellUri: cell.uri }, output, cellTop, offset);
26382641
} else {
26392642
const outputIndex = cell.outputsViewModels.indexOf(output.source);
26402643
const outputOffset = cell.getOutputOffset(outputIndex);

0 commit comments

Comments
 (0)