From 18e43769fd2dfe7727ddd53ada485ffae12c67ee Mon Sep 17 00:00:00 2001 From: "Tyler Leonhardt (POWERSHELL)" Date: Tue, 26 Feb 2019 15:52:42 -0800 Subject: [PATCH] Support -CustomPipeName --- package.json | 9 ++++++--- src/features/DebugSession.ts | 9 +++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index f8e9726f35..099d57f9d8 100644 --- a/package.json +++ b/package.json @@ -394,7 +394,6 @@ "name": "PowerShell Attach to Host Process", "type": "PowerShell", "request": "attach", - "processId": "^\"\\${command:PickPSHostProcess}\"", "runspaceId": 1 } }, @@ -445,12 +444,17 @@ "processId": { "type": "string", "description": "The process id of the PowerShell host process to attach to. Works only on PowerShell 5 and above.", - "default": "${command:PickPSHostProcess}" + "default": null }, "runspaceId": { "type": "number", "description": "Optional: The ID of the runspace to debug in the attached process. Defaults to 1. Works only on PowerShell 5 and above.", "default": 1 + }, + "customPipeName": { + "type": "string", + "description": "The custom pipe name of the PowerShell host process to attach to. Works only on PowerShell 6.2 and above.", + "default": null } } } @@ -487,7 +491,6 @@ "name": "PowerShell Attach to Host Process", "type": "powershell", "request": "attach", - "processId": "${command:PickPSHostProcess}", "runspaceId": 1 }, { diff --git a/src/features/DebugSession.ts b/src/features/DebugSession.ts index a8c55322f8..0cfbefc17f 100644 --- a/src/features/DebugSession.ts +++ b/src/features/DebugSession.ts @@ -43,10 +43,10 @@ export class DebugSessionFeature implements IFeature, DebugConfigurationProvider } // DebugConfigurationProvider method - public resolveDebugConfiguration( + public async resolveDebugConfiguration( folder: WorkspaceFolder | undefined, config: DebugConfiguration, - token?: CancellationToken): ProviderResult { + token?: CancellationToken): Promise { // Make sure there is a session running before attempting to debug/run a program if (this.sessionManager.getSessionStatus() !== SessionStatus.Running) { @@ -76,6 +76,11 @@ export class DebugSessionFeature implements IFeature, DebugConfigurationProvider return undefined; }); } + + // if nothing is set, prompt for the processId + if (!config.customPipeName && !config.processId) { + config.processId = await vscode.commands.executeCommand("PowerShell.PickPSHostProcess"); + } } if (generateLaunchConfig) {