@@ -11,11 +11,19 @@ const DEBUG_ADAPTER_DEFAULT_HOST = "127.0.0.1";
1111class RobotCodeDebugConfigurationProvider implements vscode . DebugConfigurationProvider {
1212 constructor ( private readonly pythonManager : PythonManager ) { }
1313
14- resolveDebugConfigurationWithSubstitutedVariables ? (
14+ resolveDebugConfigurationWithSubstitutedVariables (
1515 folder : vscode . WorkspaceFolder | undefined ,
1616 debugConfiguration : vscode . DebugConfiguration ,
1717 _token ?: vscode . CancellationToken
1818 ) : vscode . ProviderResult < vscode . DebugConfiguration > {
19+ return this . _resolveDebugConfigurationWithSubstitutedVariablesAsync ( folder , debugConfiguration , _token ) ;
20+ }
21+
22+ async _resolveDebugConfigurationWithSubstitutedVariablesAsync (
23+ folder : vscode . WorkspaceFolder | undefined ,
24+ debugConfiguration : vscode . DebugConfiguration ,
25+ _token ?: vscode . CancellationToken
26+ ) : Promise < vscode . DebugConfiguration > {
1927 const config = vscode . workspace . getConfiguration ( CONFIG_SECTION , folder ) ;
2028
2129 try {
@@ -46,14 +54,34 @@ class RobotCodeDebugConfigurationProvider implements vscode.DebugConfigurationPr
4654 debugConfiguration . outputDir =
4755 debugConfiguration ?. outputDir ?? config . get < string | undefined > ( "robot.outputDir" , undefined ) ;
4856
49- // if (pythonDebugpyPath) {
50- // debugConfiguration.env = { PYTHONPATH: path.dirname(pythonDebugpyPath), ...debugConfiguration.env };
51- // }
57+ debugConfiguration . attachPython = debugConfiguration ?. attachPython ?? config . get < boolean > ( "debug.attachPython" ) ;
58+
59+ debugConfiguration . outputMessages =
60+ debugConfiguration ?. outputMessages ?? config . get < boolean > ( "debug.outputMessages" ) ;
61+
62+ debugConfiguration . outputLog = debugConfiguration ?. outputLog ?? config . get < boolean > ( "debug.outputLog" ) ;
63+
64+ debugConfiguration . groupOutput = debugConfiguration ?. groupOutput ?? config . get < boolean > ( "debug.groupOutput" ) ;
5265
5366 if ( ! debugConfiguration . attachPython || debugConfiguration . noDebug ) {
5467 debugConfiguration . attachPython = false ;
5568 }
5669
70+ if ( debugConfiguration . attachPython && ! config . get < boolean > ( "debug.useExternalDebugpy" ) ) {
71+ const debugpyPath = await this . pythonManager . pythonExtension ?. exports . debug . getDebuggerPackagePath ( ) ;
72+
73+ if ( debugpyPath ) {
74+ const env = debugConfiguration . env ?? { } ;
75+ const envPythonPath : string = env . PYTHONPATH || "" ;
76+
77+ env . PYTHONPATH = [
78+ path . dirname ( debugpyPath ) ,
79+ ...( envPythonPath ? envPythonPath . split ( path . delimiter ) : [ ] ) ,
80+ ] . join ( path . delimiter ) ;
81+ debugConfiguration . env = env ;
82+ }
83+ }
84+
5785 const template = config . get ( "debug.defaultConfiguration" , { } ) ;
5886
5987 return { ...template , ...debugConfiguration } ;
0 commit comments