22// Licensed under the MIT License.
33
44import type * as nbformat from '@jupyterlab/nbformat' ;
5- import { NotebookCellOutput , NotebookCellOutputItem , NotebookCell , Position , Range } from 'vscode' ;
5+ import { NotebookCell , NotebookCellOutput , NotebookCellOutputItem , Position , Range } from 'vscode' ;
66// eslint-disable-next-line @typescript-eslint/no-require-imports
77import type { KernelMessage } from '@jupyterlab/services' ;
88import fastDeepEqual from 'fast-deep-equal' ;
9- import * as path from '../../platform/vscode-path/path' ;
10- import * as uriPath from '../../platform/vscode-path/resources' ;
9+ import { Pocket } from '../../platform/deepnote/pocket' ;
1110import { PYTHON_LANGUAGE } from '../../platform/common/constants' ;
1211import { concatMultilineString , splitMultilineString } from '../../platform/common/utils' ;
12+ import { StopWatch } from '../../platform/common/utils/stopWatch' ;
13+ import { base64ToUint8Array , uint8ArrayToBase64 } from '../../platform/common/utils/string' ;
14+ import { CHART_BIG_NUMBER_MIME_TYPE } from '../../platform/deepnote/deepnoteConstants' ;
15+ import { getExtensionSpecificStack } from '../../platform/errors/errors' ;
16+ import { createOutputWithErrorMessageForDisplay } from '../../platform/errors/errorUtils' ;
17+ import { getCachedEnvironment , getVersion } from '../../platform/interpreter/helpers' ;
1318import { logger } from '../../platform/logging' ;
19+ import type { NotebookCellExecutionState } from '../../platform/notebooks/cellExecutionStateService' ;
20+ import * as path from '../../platform/vscode-path/path' ;
21+ import * as uriPath from '../../platform/vscode-path/resources' ;
1422import { sendTelemetryEvent , Telemetry } from '../../telemetry' ;
15- import { createOutputWithErrorMessageForDisplay } from '../../platform/errors/errorUtils' ;
16- import { CellExecutionCreator } from './cellExecutionCreator' ;
17- import { IKernelController , KernelConnectionMetadata } from '../types' ;
1823import {
19- isPythonKernelConnection ,
2024 getInterpreterFromKernelConnectionMetadata ,
21- kernelConnectionMetadataHasKernelModel ,
22- getKernelRegistrationInfo
25+ getKernelRegistrationInfo ,
26+ isPythonKernelConnection ,
27+ kernelConnectionMetadataHasKernelModel
2328} from '../helpers' ;
24- import { StopWatch } from '../../platform/common/utils/stopWatch' ;
25- import { getExtensionSpecificStack } from '../../platform/errors/errors' ;
26- import { getCachedEnvironment , getVersion } from '../../platform/interpreter/helpers' ;
27- import { base64ToUint8Array , uint8ArrayToBase64 } from '../../platform/common/utils/string' ;
28- import type { NotebookCellExecutionState } from '../../platform/notebooks/cellExecutionStateService' ;
29+ import { IKernelController , KernelConnectionMetadata } from '../types' ;
30+ import { CellExecutionCreator } from './cellExecutionCreator' ;
2931
3032export enum CellOutputMimeTypes {
3133 error = 'application/vnd.code.notebook.error' ,
@@ -260,6 +262,9 @@ function translateDisplayDataOutput(
260262 }
261263 }
262264 */
265+ const deepnotePocket = cellMetadata ?. __deepnotePocket as Pocket | undefined ;
266+ const deepnoteBlockType = deepnotePocket ?. type ;
267+
263268 const metadata = getOutputMetadata ( output , cellIndex , cellId , cellMetadata ) ;
264269 // If we have SVG or PNG, then add special metadata to indicate whether to display `open plot`
265270 if ( 'image/svg+xml' in output . data || 'image/png' in output . data ) {
@@ -269,7 +274,9 @@ function translateDisplayDataOutput(
269274 if ( output . data ) {
270275 // eslint-disable-next-line no-restricted-syntax
271276 for ( const key in output . data ) {
272- items . push ( convertJupyterOutputToBuffer ( key , output . data [ key ] ) ) ;
277+ // TODO - remove this once this is handled in the deepnote-toolkit
278+ let effectiveKey = deepnoteBlockType === 'big-number' ? CHART_BIG_NUMBER_MIME_TYPE : key ;
279+ items . push ( convertJupyterOutputToBuffer ( effectiveKey , output . data [ key ] ?? output . data [ effectiveKey ] ) ) ;
273280 }
274281 }
275282
0 commit comments