diff --git a/module/PowerShellEditorServices/Commands/Public/Start-DebugAttachSession.ps1 b/module/PowerShellEditorServices/Commands/Public/Start-DebugAttachSession.ps1 index a3df340d2..9b12fe6ad 100644 --- a/module/PowerShellEditorServices/Commands/Public/Start-DebugAttachSession.ps1 +++ b/module/PowerShellEditorServices/Commands/Public/Start-DebugAttachSession.ps1 @@ -38,6 +38,11 @@ function Start-DebugAttachSession { [string] $ComputerName, + [Parameter()] + [ValidateSet('Close', 'Hide', 'Keep')] + [string] + $WindowActionOnEnd, + [Parameter()] [switch] $AsJob @@ -127,6 +132,10 @@ function Start-DebugAttachSession { $configuration.runspaceName = $RunspaceName } + if ($WindowActionOnEnd) { + $configuration.temporaryConsoleWindowActionOnDebugEnd = $WindowActionOnEnd.ToLowerInvariant() + } + # https://microsoft.github.io/debug-adapter-protocol/specification#Reverse_Requests_StartDebugging $resp = $debugServer.SendRequest( 'startDebugging', diff --git a/module/docs/Start-DebugAttachSession.md b/module/docs/Start-DebugAttachSession.md index 1fa7bf785..0e3fbfdc1 100644 --- a/module/docs/Start-DebugAttachSession.md +++ b/module/docs/Start-DebugAttachSession.md @@ -16,13 +16,14 @@ Starts a new debug session attached to the specified PowerShell instance. ### ProcessId (Default) ``` Start-DebugAttachSession [-Name ] [-ProcessId ] [-RunspaceName ] [-RunspaceId ] - [-ComputerName ] [-AsJob] [] + [-ComputerName ] [-WindowActionOnEnd {Close | Hide | Keep}] [-AsJob] [] ``` ### CustomPipeName ``` Start-DebugAttachSession [-Name ] [-CustomPipeName ] [-RunspaceName ] - [-RunspaceId ] [-ComputerName ] [-AsJob] [] + [-RunspaceId ] [-ComputerName ] [-WindowActionOnEnd {Close | Hide | Keep}] [-AsJob] + [] ``` ## DESCRIPTION @@ -190,6 +191,22 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -WindowActionOnEnd + +Specifies the action to take on the temporary debug console created by the debug client after the attached session ends. This corresponds to the VSCode attach configuration option `temporaryConsoleWindowActionOnDebugEnd`. Setting to `Close` will close the debug console, `Hide` will move back to the last debug console before the attach session started, and `Keep` (default) will keep the active terminal as the attached session. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### CommonParameters This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).