Skip to content

Commit 3a283f3

Browse files
Support -CustomPipeName (#1775)
1 parent ccb7d76 commit 3a283f3

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

package.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,6 @@
389389
"name": "PowerShell Attach to Host Process",
390390
"type": "PowerShell",
391391
"request": "attach",
392-
"processId": "^\"\\${command:PickPSHostProcess}\"",
393392
"runspaceId": 1
394393
}
395394
},
@@ -440,12 +439,17 @@
440439
"processId": {
441440
"type": "string",
442441
"description": "The process id of the PowerShell host process to attach to. Works only on PowerShell 5 and above.",
443-
"default": "${command:PickPSHostProcess}"
442+
"default": null
444443
},
445444
"runspaceId": {
446445
"type": "number",
447446
"description": "Optional: The ID of the runspace to debug in the attached process. Defaults to 1. Works only on PowerShell 5 and above.",
448447
"default": 1
448+
},
449+
"customPipeName": {
450+
"type": "string",
451+
"description": "The custom pipe name of the PowerShell host process to attach to. Works only on PowerShell 6.2 and above.",
452+
"default": null
449453
}
450454
}
451455
}
@@ -482,7 +486,6 @@
482486
"name": "PowerShell Attach to Host Process",
483487
"type": "PowerShell",
484488
"request": "attach",
485-
"processId": "${command:PickPSHostProcess}",
486489
"runspaceId": 1
487490
},
488491
{

src/features/DebugSession.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ export class DebugSessionFeature implements IFeature, DebugConfigurationProvider
4343
}
4444

4545
// DebugConfigurationProvider method
46-
public resolveDebugConfiguration(
46+
public async resolveDebugConfiguration(
4747
folder: WorkspaceFolder | undefined,
4848
config: DebugConfiguration,
49-
token?: CancellationToken): ProviderResult<DebugConfiguration> {
49+
token?: CancellationToken): Promise<DebugConfiguration> {
5050

5151
// Make sure there is a session running before attempting to debug/run a program
5252
if (this.sessionManager.getSessionStatus() !== SessionStatus.Running) {
@@ -76,6 +76,11 @@ export class DebugSessionFeature implements IFeature, DebugConfigurationProvider
7676
return undefined;
7777
});
7878
}
79+
80+
// if nothing is set, prompt for the processId
81+
if (!config.customPipeName && !config.processId) {
82+
config.processId = await vscode.commands.executeCommand("PowerShell.PickPSHostProcess");
83+
}
7984
}
8085

8186
if (generateLaunchConfig) {

0 commit comments

Comments
 (0)