Another question addresses how to debug a Powershell cmdlet written in C# in Visual Studio 2015-19: Debugging / unloading PowerShell Cmdlet
I could somehow invoke a script like this:
function Start-DebugPowerShell
{
PowerShell -NoProfile -NoExit -Command {
function prompt {
$newPrompt = "$pwd.Path [DEBUG]"
Write-Host -NoNewline -ForegroundColor Yellow $newPrompt
return '> '
}
}
}
Set-Alias -Name sdp -Value Start-DebugPowerShell
This makes it easy to create a temp PS instance that you can exit to unload.
Or I can set the Debug options in the VS Project like this and it works great:

I'd like to do the same thing, but using Visual Studio Code. I know how to debug this using attach (e.g. with these launch.json settings:
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}",
"justMyCode": false
}
I can't figure out how to craft a launch.json that first launches pwsh. The project type is csharp and thus the only types available in launch.json are coreclr and clr.