Skip to content

Support -CustomPipeName #1775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@
"name": "PowerShell Attach to Host Process",
"type": "PowerShell",
"request": "attach",
"processId": "^\"\\${command:PickPSHostProcess}\"",
"runspaceId": 1
}
},
Expand Down Expand Up @@ -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
}
}
}
Expand Down Expand Up @@ -487,7 +491,6 @@
"name": "PowerShell Attach to Host Process",
"type": "powershell",
"request": "attach",
"processId": "${command:PickPSHostProcess}",
"runspaceId": 1
},
{
Expand Down
9 changes: 7 additions & 2 deletions src/features/DebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<DebugConfiguration> {
token?: CancellationToken): Promise<DebugConfiguration> {

// Make sure there is a session running before attempting to debug/run a program
if (this.sessionManager.getSessionStatus() !== SessionStatus.Running) {
Expand Down Expand Up @@ -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) {
Expand Down