@@ -17,16 +17,7 @@ import { EXTENSION_ROOT_DIR } from '../../constants';
17
17
import { captureTelemetry , sendTelemetryEvent } from '../../telemetry' ;
18
18
import { concatMultilineStringOutput } from '../common' ;
19
19
import { Identifiers , Telemetry } from '../constants' ;
20
- import {
21
- CellState ,
22
- ICell ,
23
- ICellHashListener ,
24
- IConnection ,
25
- IFileHashes ,
26
- IJupyterDebugger ,
27
- INotebook ,
28
- ISourceMapRequest
29
- } from '../types' ;
20
+ import { CellState , ICell , ICellHashListener , IConnection , IFileHashes , IJupyterDebugger , INotebook , ISourceMapRequest } from '../types' ;
30
21
import { JupyterDebuggerNotInstalledError } from './jupyterDebuggerNotInstalledError' ;
31
22
import { JupyterDebuggerRemoteNotSupported } from './jupyterDebuggerRemoteNotSupported' ;
32
23
import { ILiveShareHasRole } from './liveshare/types' ;
@@ -45,8 +36,7 @@ export class JupyterDebugger implements IJupyterDebugger, ICellHashListener {
45
36
@inject ( IPlatformService ) private platform : IPlatformService ,
46
37
@inject ( IWorkspaceService ) private workspace : IWorkspaceService ,
47
38
@inject ( IExperimentsManager ) private readonly experimentsManager : IExperimentsManager
48
- ) {
49
- }
39
+ ) { }
50
40
51
41
public async startDebugging ( notebook : INotebook ) : Promise < void > {
52
42
traceInfo ( 'start debugging' ) ;
@@ -114,9 +104,11 @@ export class JupyterDebugger implements IJupyterDebugger, ICellHashListener {
114
104
public async hashesUpdated ( hashes : IFileHashes [ ] ) : Promise < void > {
115
105
// Make sure that we have an active debugging session at this point
116
106
if ( this . debugService . activeDebugSession ) {
117
- await Promise . all ( hashes . map ( ( fileHash ) => {
118
- return this . debugService . activeDebugSession ! . customRequest ( 'setPydevdSourceMap' , this . buildSourceMap ( fileHash ) ) ;
119
- } ) ) ;
107
+ await Promise . all (
108
+ hashes . map ( fileHash => {
109
+ return this . debugService . activeDebugSession ! . customRequest ( 'setPydevdSourceMap' , this . buildSourceMap ( fileHash ) ) ;
110
+ } )
111
+ ) ;
120
112
}
121
113
}
122
114
@@ -184,20 +176,19 @@ export class JupyterDebugger implements IJupyterDebugger, ICellHashListener {
184
176
*/
185
177
private async getPtvsdPath ( notebook : INotebook ) : Promise < string > {
186
178
const oldPtvsd = path . join ( EXTENSION_ROOT_DIR , 'pythonFiles' , 'lib' , 'python' , 'old_ptvsd' ) ;
187
- if ( ! this . experimentsManager . inExperiment ( DebugAdapterDescriptorFactory . experiment ) ||
188
- ! this . experimentsManager . inExperiment ( DebugAdapterNewPtvsd . experiment ) ) {
179
+ if ( ! this . experimentsManager . inExperiment ( DebugAdapterDescriptorFactory . experiment ) || ! this . experimentsManager . inExperiment ( DebugAdapterNewPtvsd . experiment ) ) {
189
180
return oldPtvsd ;
190
181
}
191
182
const pythonVersion = await this . getKernelPythonVersion ( notebook ) ;
192
183
// The new debug adapter with wheels is only supported in 3.7
193
184
// Code can be found here (src/client/debugger/extension/adapter/factory.ts).
194
- if ( ! pythonVersion || ! ( pythonVersion . major === 3 && pythonVersion . minor === 7 ) ) {
195
- // Return debugger without wheels
196
- path . join ( EXTENSION_ROOT_DIR , 'pythonFiles' , 'lib' , 'python' , 'new_ptvsd' , 'no_wheels ' ) ;
185
+ if ( pythonVersion && pythonVersion . major === 3 && pythonVersion . minor === 7 ) {
186
+ // Return debugger with wheels
187
+ return path . join ( EXTENSION_ROOT_DIR , 'pythonFiles' , 'lib' , 'python' , 'new_ptvsd' , 'wheels ' ) ;
197
188
}
198
189
199
- // We are here so tis is python 3.7, return debugger with wheels
200
- return path . join ( EXTENSION_ROOT_DIR , 'pythonFiles' , 'lib' , 'python' , 'new_ptvsd' , 'wheels ' ) ;
190
+ // We are here so this is NOT python 3.7, return debugger without wheels
191
+ return path . join ( EXTENSION_ROOT_DIR , 'pythonFiles' , 'lib' , 'python' , 'new_ptvsd' , 'no_wheels ' ) ;
201
192
}
202
193
private async calculatePtvsdPathList ( notebook : INotebook ) : Promise < string | undefined > {
203
194
const extraPaths : string [ ] = [ ] ;
@@ -313,7 +304,12 @@ export class JupyterDebugger implements IJupyterDebugger, ICellHashListener {
313
304
const minor = parseInt ( packageVersionMatch [ 2 ] , 10 ) ;
314
305
const patch = parseInt ( packageVersionMatch [ 3 ] , 10 ) ;
315
306
return {
316
- major, minor, patch, build : [ ] , prerelease : [ ] , raw : `${ major } .${ minor } .${ patch } `
307
+ major,
308
+ minor,
309
+ patch,
310
+ build : [ ] ,
311
+ prerelease : [ ] ,
312
+ raw : `${ major } .${ minor } .${ patch } `
317
313
} ;
318
314
}
319
315
}
@@ -337,7 +333,11 @@ export class JupyterDebugger implements IJupyterDebugger, ICellHashListener {
337
333
@captureTelemetry ( Telemetry . PtvsdPromptToInstall )
338
334
private async promptToInstallPtvsd ( notebook : INotebook , oldVersion : Version | undefined ) : Promise < void > {
339
335
const promptMessage = oldVersion ? localize . DataScience . jupyterDebuggerInstallPtvsdUpdate ( ) : localize . DataScience . jupyterDebuggerInstallPtvsdNew ( ) ;
340
- const result = await this . appShell . showInformationMessage ( promptMessage , localize . DataScience . jupyterDebuggerInstallPtvsdYes ( ) , localize . DataScience . jupyterDebuggerInstallPtvsdNo ( ) ) ;
336
+ const result = await this . appShell . showInformationMessage (
337
+ promptMessage ,
338
+ localize . DataScience . jupyterDebuggerInstallPtvsdYes ( ) ,
339
+ localize . DataScience . jupyterDebuggerInstallPtvsdNo ( )
340
+ ) ;
341
341
342
342
if ( result === localize . DataScience . jupyterDebuggerInstallPtvsdYes ( ) ) {
343
343
await this . installPtvsd ( notebook ) ;
@@ -426,7 +426,7 @@ export class JupyterDebugger implements IJupyterDebugger, ICellHashListener {
426
426
const data = outputs [ 0 ] . data ;
427
427
if ( data && data . hasOwnProperty ( 'text/plain' ) ) {
428
428
// tslint:disable-next-line:no-any
429
- return ( ( data as any ) [ 'text/plain' ] ) ;
429
+ return ( data as any ) [ 'text/plain' ] ;
430
430
}
431
431
if ( outputs [ 0 ] . output_type === 'stream' ) {
432
432
const stream = outputs [ 0 ] as nbformat . IStream ;
0 commit comments