Skip to content

Commit 647b253

Browse files
Support -CustomPipeName
1 parent 1917544 commit 647b253

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
@@ -394,7 +394,6 @@
394394
"name": "PowerShell Attach to Host Process",
395395
"type": "PowerShell",
396396
"request": "attach",
397-
"processId": "^\"\\${command:PickPSHostProcess}\"",
398397
"runspaceId": 1
399398
}
400399
},
@@ -445,12 +444,17 @@
445444
"processId": {
446445
"type": "string",
447446
"description": "The process id of the PowerShell host process to attach to. Works only on PowerShell 5 and above.",
448-
"default": "${command:PickPSHostProcess}"
447+
"default": null
449448
},
450449
"runspaceId": {
451450
"type": "number",
452451
"description": "Optional: The ID of the runspace to debug in the attached process. Defaults to 1. Works only on PowerShell 5 and above.",
453452
"default": 1
453+
},
454+
"customPipeName": {
455+
"type": "string",
456+
"description": "The custom pipe name of the PowerShell host process to attach to. Works only on PowerShell 6.2 and above.",
457+
"default": null
454458
}
455459
}
456460
}
@@ -487,7 +491,6 @@
487491
"name": "PowerShell Attach to Host Process",
488492
"type": "powershell",
489493
"request": "attach",
490-
"processId": "${command:PickPSHostProcess}",
491494
"runspaceId": 1
492495
},
493496
{

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)