@@ -17,6 +17,7 @@ import { IConfigurationService, IExperimentsManager, Version } from '../../commo
1717import * as localize from '../../common/utils/localize' ;
1818import { EXTENSION_ROOT_DIR } from '../../constants' ;
1919import { captureTelemetry , sendTelemetryEvent } from '../../telemetry' ;
20+ import { traceCellResults } from '../common' ;
2021import { Identifiers , Telemetry } from '../constants' ;
2122import {
2223 CellState ,
@@ -164,30 +165,14 @@ export class JupyterDebugger implements IJupyterDebugger, ICellHashListener {
164165 if ( importResults . length === 0 || importResults [ 0 ] . state === CellState . error ) {
165166 traceWarning ( `${ this . debuggerPackage } not found in path.` ) ;
166167 } else {
167- this . traceCellResults ( 'import startup' , importResults ) ;
168+ traceCellResults ( 'import startup' , importResults ) ;
168169 }
169170
170171 // Then enable tracing
171172 await this . executeSilently ( notebook , this . tracingEnableCode ) ;
172173 }
173174 }
174175
175- private traceCellResults ( prefix : string , results : ICell [ ] ) {
176- if ( results . length > 0 && results [ 0 ] . data . cell_type === 'code' ) {
177- const cell = results [ 0 ] . data as nbformat . ICodeCell ;
178- const error = cell . outputs && cell . outputs [ 0 ] ? cell . outputs [ 0 ] . evalue : undefined ;
179- if ( error ) {
180- traceError ( `${ prefix } Error : ${ error } ` ) ;
181- } else if ( cell . outputs && cell . outputs [ 0 ] ) {
182- const data = cell . outputs [ 0 ] . data ;
183- const text = cell . outputs [ 0 ] . text ;
184- traceInfo ( `${ prefix } Output: ${ text || JSON . stringify ( data ) } ` ) ;
185- }
186- } else {
187- traceInfo ( `${ prefix } no output.` ) ;
188- }
189- }
190-
191176 private async connect (
192177 notebook : INotebook ,
193178 runByLine : boolean ,
@@ -322,7 +307,7 @@ export class JupyterDebugger implements IJupyterDebugger, ICellHashListener {
322307 notebook ,
323308 `import sys\r\nsys.path.extend([${ debuggerPathList } ])\r\nsys.path`
324309 ) ;
325- this . traceCellResults ( 'Appending paths' , result ) ;
310+ traceCellResults ( 'Appending paths' , result ) ;
326311 }
327312 }
328313
@@ -369,7 +354,7 @@ export class JupyterDebugger implements IJupyterDebugger, ICellHashListener {
369354 purpose : 'parsePtvsdVersionInfo' | 'parseDebugpyVersionInfo' | 'pythonVersionInfo'
370355 ) : Version | undefined {
371356 if ( cells . length < 1 || cells [ 0 ] . state !== CellState . finished ) {
372- this . traceCellResults ( purpose , cells ) ;
357+ traceCellResults ( purpose , cells ) ;
373358 return undefined ;
374359 }
375360
@@ -397,7 +382,7 @@ export class JupyterDebugger implements IJupyterDebugger, ICellHashListener {
397382 }
398383 }
399384
400- this . traceCellResults ( purpose , cells ) ;
385+ traceCellResults ( purpose , cells ) ;
401386
402387 return undefined ;
403388 }
@@ -452,7 +437,7 @@ export class JupyterDebugger implements IJupyterDebugger, ICellHashListener {
452437 return ;
453438 }
454439 }
455- this . traceCellResults ( `Installing ${ this . debuggerPackage } ` , debuggerInstallResults ) ;
440+ traceCellResults ( `Installing ${ this . debuggerPackage } ` , debuggerInstallResults ) ;
456441 sendTelemetryEvent ( Telemetry . PtvsdInstallFailed ) ;
457442 traceError ( `Failed to install ${ this . debuggerPackage } ` ) ;
458443 // Failed to install debugger, throw to exit debugging
0 commit comments