File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed
Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -349,45 +349,51 @@ export class RNotebookProvider implements vscode.NotebookContentProvider, vscode
349349 cell . metadata . lastRunDuration = + new Date ( ) - cell . metadata . runStartTime ;
350350 console . log ( `uri: ${ cell . uri } , id: ${ response . id } , type: ${ response . type } , result: ${ response . result } ` ) ;
351351 switch ( response . type ) {
352- case 'text' :
352+ case 'text' : {
353353 cell . outputs = [ {
354354 outputKind : vscode . CellOutputKind . Text ,
355355 text : response . result ,
356356 } ] ;
357357 break ;
358- case 'plot' :
358+ }
359+ case 'plot' : {
360+ const content = ( await vscode . workspace . fs . readFile ( vscode . Uri . parse ( response . result ) ) ) . toString ( ) ;
359361 cell . outputs = [ {
360362 outputKind : vscode . CellOutputKind . Rich ,
361363 data : {
362- 'image/svg+xml' : ( await vscode . workspace . fs . readFile ( vscode . Uri . parse ( response . result ) ) ) . toString ( ) ,
364+ 'image/svg+xml' : content ,
363365 } ,
364366 } ] ;
365367 break ;
366- case 'viewer' :
368+ }
369+ case 'viewer' : {
367370 cell . outputs = [ {
368371 outputKind : vscode . CellOutputKind . Rich ,
369372 data : {
370- 'application/json ' : response . result ,
373+ 'text/plain ' : response . result ,
371374 } ,
372375 } ] ;
373376 break ;
374- case 'browser' :
377+ }
378+ case 'browser' : {
375379 cell . outputs = [ {
376380 outputKind : vscode . CellOutputKind . Rich ,
377381 data : {
378- 'application/json ' : response . result ,
382+ 'text/plain ' : response . result ,
379383 } ,
380384 } ] ;
381385 break ;
382- case 'error' :
386+ }
387+ case 'error' : {
383388 cell . metadata . runState = vscode . NotebookCellRunState . Error ;
384389 cell . outputs = [ {
385390 outputKind : vscode . CellOutputKind . Error ,
386391 evalue : response . result ,
387- ename : '' ,
392+ ename : 'Error ' ,
388393 traceback : [ ] ,
389394 } ] ;
390395 break ;
396+ }
391397 }
392398 } catch ( e ) {
393399 cell . outputs = [ {
You can’t perform that action at this time.
0 commit comments