Skip to content

Commit 5ebe7eb

Browse files
committed
fix #110750.
1 parent 195779a commit 5ebe7eb

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { NotebookKernelProviderAssociationRegistry, NotebookViewTypesExtensionRe
2828
import { CellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel';
2929
import { NotebookCellTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookCellTextModel';
3030
import { NotebookTextModel } from 'vs/workbench/contrib/notebook/common/model/notebookTextModel';
31-
import { ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER, BUILTIN_RENDERER_ID, CellKind, CellOutputKind, DisplayOrderKey, IDisplayOutput, INotebookDecorationRenderOptions, INotebookKernelInfo2, INotebookKernelProvider, INotebookRendererInfo, INotebookTextModel, IOrderedMimeType, ITransformedDisplayOutputDto, mimeTypeSupportedByCore, notebookDocumentFilterMatch, NotebookEditorPriority, NOTEBOOK_DISPLAY_ORDER, sortMimeTypes } from 'vs/workbench/contrib/notebook/common/notebookCommon';
31+
import { ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER, BUILTIN_RENDERER_ID, CellKind, CellOutputKind, DisplayOrderKey, IDisplayOutput, INotebookDecorationRenderOptions, INotebookKernelInfo2, INotebookKernelProvider, INotebookRendererInfo, INotebookTextModel, IOrderedMimeType, ITransformedDisplayOutputDto, mimeTypeSupportedByCore, notebookDocumentFilterMatch, NotebookEditorPriority, NOTEBOOK_DISPLAY_ORDER, RENDERER_NOT_AVAILABLE, sortMimeTypes } from 'vs/workbench/contrib/notebook/common/notebookCommon';
3232
import { NotebookOutputRendererInfo } from 'vs/workbench/contrib/notebook/common/notebookOutputRenderer';
3333
import { NotebookEditorDescriptor, NotebookProviderInfo } from 'vs/workbench/contrib/notebook/common/notebookProvider';
3434
import { IMainNotebookController, INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService';
@@ -767,10 +767,17 @@ export class NotebookService extends Disposable implements INotebookService, ICu
767767
});
768768
}
769769
} else {
770-
orderMimeTypes.push({
771-
mimeType: mimeType,
772-
rendererId: BUILTIN_RENDERER_ID
773-
});
770+
if (mimeTypeSupportedByCore(mimeType)) {
771+
orderMimeTypes.push({
772+
mimeType: mimeType,
773+
rendererId: BUILTIN_RENDERER_ID
774+
});
775+
} else {
776+
orderMimeTypes.push({
777+
mimeType: mimeType,
778+
rendererId: RENDERER_NOT_AVAILABLE
779+
});
780+
}
774781
}
775782
});
776783

src/vs/workbench/contrib/notebook/browser/view/renderers/codeCell.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { EDITOR_BOTTOM_PADDING, EDITOR_TOP_PADDING } from 'vs/workbench/contrib/
2323
import { CellFocusMode, CodeCellRenderTemplate, INotebookEditor } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
2424
import { getResizesObserver } from 'vs/workbench/contrib/notebook/browser/view/renderers/sizeObserver';
2525
import { CodeCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel';
26-
import { BUILTIN_RENDERER_ID, CellOutputKind, CellUri, IInsetRenderOutput, IProcessedOutput, IRenderOutput, ITransformedDisplayOutputDto, outputHasDynamicHeight, RenderOutputType } from 'vs/workbench/contrib/notebook/common/notebookCommon';
26+
import { BUILTIN_RENDERER_ID, CellOutputKind, CellUri, IInsetRenderOutput, IProcessedOutput, IRenderOutput, ITransformedDisplayOutputDto, outputHasDynamicHeight, RENDERER_NOT_AVAILABLE, RenderOutputType } from 'vs/workbench/contrib/notebook/common/notebookCommon';
2727
import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService';
2828
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
2929
import { ClickTargetType } from 'vs/workbench/contrib/notebook/browser/view/renderers/cellWidgets';
@@ -67,7 +67,8 @@ class OutputElement extends Disposable {
6767
const transformedDisplayOutput = this.output as ITransformedDisplayOutputDto;
6868

6969
const mimeTypes = this.notebookService.getMimeTypeInfo(this.notebookEditor.textModel!, this.output);
70-
const pick = this.pickedMimeTypes.get(this.output) ?? 0;
70+
71+
const pick = this.pickedMimeTypes.get(this.output) ?? Math.max(mimeTypes.findIndex(mimeType => mimeType.rendererId !== RENDERER_NOT_AVAILABLE), 0);
7172

7273
if (mimeTypes.length > 1) {
7374
outputItemDiv.style.position = 'relative';

src/vs/workbench/contrib/notebook/common/notebookCommon.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export const ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER = [
5858
];
5959

6060
export const BUILTIN_RENDERER_ID = '_builtin';
61+
export const RENDERER_NOT_AVAILABLE = '_notAvailable';
6162

6263
export enum NotebookRunState {
6364
Running = 1,

0 commit comments

Comments
 (0)