@@ -20,7 +20,7 @@ import {
20
20
} from './goInstallTools' ;
21
21
import { packagePathToGoModPathMap } from './goModules' ;
22
22
import { getTool , getToolAtVersion } from './goTools' ;
23
- import { pickProcess , pickProcessByName } from './pickProcess' ;
23
+ import { pickGoProcess , pickProcess , pickProcessByName } from './pickProcess' ;
24
24
import { getFromGlobalState , updateGlobalState } from './stateUtils' ;
25
25
import { getBinPath , getGoVersion } from './util' ;
26
26
import { parseEnvFiles } from './utils/envUtils' ;
@@ -313,16 +313,13 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr
313
313
if ( debugConfiguration . request === 'attach' && debugConfiguration [ 'mode' ] === 'local' ) {
314
314
if ( ! debugConfiguration [ 'processId' ] || debugConfiguration [ 'processId' ] === 0 ) {
315
315
// The processId is not valid, offer a quickpick menu of all processes.
316
- debugConfiguration [ 'processId' ] = parseInt ( await pickProcess ( ) , 10 ) ;
316
+ debugConfiguration [ 'processId' ] = await pickProcess ( ) ;
317
317
} else if (
318
318
typeof debugConfiguration [ 'processId' ] === 'string' &&
319
319
debugConfiguration [ 'processId' ] !== '${command:pickProcess}' &&
320
320
debugConfiguration [ 'processId' ] !== '${command:pickGoProcess}'
321
321
) {
322
- debugConfiguration [ 'processId' ] = parseInt (
323
- await pickProcessByName ( debugConfiguration [ 'processId' ] ) ,
324
- 10
325
- ) ;
322
+ debugConfiguration [ 'processId' ] = await pickProcessByName ( debugConfiguration [ 'processId' ] ) ;
326
323
}
327
324
}
328
325
return debugConfiguration ;
@@ -398,6 +395,15 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr
398
395
debugConfiguration [ attr ] = path . join ( workspaceRoot , debugConfiguration [ attr ] ) ;
399
396
} ) ;
400
397
}
398
+
399
+ if ( debugConfiguration . request === 'attach' && debugConfiguration [ 'mode' ] === 'local' ) {
400
+ // processId needs to be an int, but the substituted variables from pickGoProcess and pickProcess
401
+ // become a string. Convert any strings to integers.
402
+ if ( typeof debugConfiguration [ 'processId' ] === 'string' ) {
403
+ debugConfiguration [ 'processId' ] = parseInt ( debugConfiguration [ 'processId' ] , 10 ) ;
404
+ }
405
+ }
406
+
401
407
return debugConfiguration ;
402
408
}
403
409
0 commit comments