@@ -15,7 +15,7 @@ import {
15
15
} from 'vscode' ;
16
16
import { EXTENSION_ROOT_DIR } from '../../../constants' ;
17
17
import { IInterpreterService } from '../../../interpreter/contracts' ;
18
- import { traceLog , traceVerbose } from '../../../logging' ;
18
+ import { traceError , traceLog , traceVerbose } from '../../../logging' ;
19
19
import { PythonEnvironment } from '../../../pythonEnvironments/info' ;
20
20
import { sendTelemetryEvent } from '../../../telemetry' ;
21
21
import { EventName } from '../../../telemetry/constants' ;
@@ -26,6 +26,7 @@ import { Common, Interpreters } from '../../../common/utils/localize';
26
26
import { IPersistentStateFactory } from '../../../common/types' ;
27
27
import { Commands } from '../../../common/constants' ;
28
28
import { ICommandManager } from '../../../common/application/types' ;
29
+ import { getDebugpyPath } from '../../pythonDebugger' ;
29
30
30
31
// persistent state names, exported to make use of in testing
31
32
export enum debugStateKeys {
@@ -90,15 +91,12 @@ export class DebugAdapterDescriptorFactory implements IDebugAdapterDescriptorFac
90
91
traceLog ( `DAP Server launched with command: ${ executable } ${ args . join ( ' ' ) } ` ) ;
91
92
return new DebugAdapterExecutable ( executable , args ) ;
92
93
}
93
-
94
- const debuggerAdapterPathToUse = path . join (
95
- EXTENSION_ROOT_DIR ,
96
- 'python_files' ,
97
- 'lib' ,
98
- 'python' ,
99
- 'debugpy' ,
100
- 'adapter' ,
101
- ) ;
94
+ const debugpyPath = await getDebugpyPath ( ) ;
95
+ if ( ! debugpyPath ) {
96
+ traceError ( 'Could not find debugpy path.' ) ;
97
+ throw new Error ( 'Could not find debugpy path.' ) ;
98
+ }
99
+ const debuggerAdapterPathToUse = path . join ( debugpyPath , 'adapter' ) ;
102
100
103
101
const args = command . concat ( [ debuggerAdapterPathToUse , ...logArgs ] ) ;
104
102
traceLog ( `DAP Server launched with command: ${ executable } ${ args . join ( ' ' ) } ` ) ;
0 commit comments