@@ -5,21 +5,19 @@ import {JupyterDisplay} from './display/main';
55import { KernelStatus } from './display/kernelStatus' ;
66import { Commands } from '../common/constants' ;
77
8- // const anser = require('anser');
9-
108export class Jupyter extends vscode . Disposable {
119 public kernelManager : KernelManagerImpl ;
1210 public kernel : Kernel = null ;
1311 private status : KernelStatus ;
1412 private disposables : vscode . Disposable [ ] ;
1513 private display : JupyterDisplay ;
1614
17- constructor ( ) {
15+ constructor ( private outputChannel : vscode . OutputChannel ) {
1816 super ( ( ) => { } ) ;
1917 this . disposables = [ ] ;
2018 }
2119 activate ( state ) {
22- this . kernelManager = new KernelManagerImpl ( ) ;
20+ this . kernelManager = new KernelManagerImpl ( this . outputChannel ) ;
2321 this . disposables . push ( this . kernelManager ) ;
2422 this . disposables . push ( vscode . window . onDidChangeActiveTextEditor ( this . onEditorChanged . bind ( this ) ) ) ;
2523 this . status = new KernelStatus ( ) ;
@@ -79,25 +77,20 @@ export class Jupyter extends vscode.Disposable {
7977 if ( ( result . type === 'text' && result . stream === 'stdout' && typeof result . data [ 'text/plain' ] === 'string' ) ||
8078 ( result . type === 'text' && result . stream === 'pyout' && typeof result . data [ 'text/plain' ] === 'string' ) ||
8179 ( result . type === 'text' && result . stream === 'error' && typeof result . data [ 'text/plain' ] === 'string' ) ) {
82- // const htmlText = anser.ansiToHtml(anser.escapeForHtml(result.data['text/plain']));
83- // htmlResponse = htmlResponse + `<p><pre>${htmlText}</pre></p>`;
8480 responses . push ( result . data ) ;
8581 if ( result . stream === 'error' ) {
8682 return resolve ( [ htmlResponse , responses ] ) ;
8783 }
8884 }
8985 if ( result . type === 'text/html' && result . stream === 'pyout' && typeof result . data [ 'text/html' ] === 'string' ) {
90- // htmlResponse = htmlResponse + result.data['text/html'];
9186 result . data [ 'text/html' ] = result . data [ 'text/html' ] . replace ( / < \/ s c r i p t > / g, '</scripts>' ) ;
9287 responses . push ( result . data ) ;
9388 }
9489 if ( result . type === 'application/javascript' && result . stream === 'pyout' && typeof result . data [ 'application/javascript' ] === 'string' ) {
9590 responses . push ( result . data ) ;
96- // htmlResponse = htmlResponse + `<script type="text/javascript">${result.data['application/javascript']}</script>`;
9791 }
9892 if ( result . type . startsWith ( 'image/' ) && result . stream === 'pyout' && typeof result . data [ result . type ] === 'string' ) {
9993 responses . push ( result . data ) ;
100- // htmlResponse = htmlResponse + `<div style="background-color:white;display:inline-block;"><img src="data:${result.type};base64,${result.data[result.type]}" /></div><div></div>`;
10194 }
10295 if ( result . data === 'ok' && result . stream === 'status' && result . type === 'text' ) {
10396 resolve ( [ htmlResponse , responses ] ) ;
0 commit comments