Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ function Start-DebugAttachSession {
[string]
$ComputerName,

[Parameter()]
[ValidateSet('Close', 'Hide', 'Keep')]
[string]
$WindowActionOnEnd,

[Parameter()]
[switch]
$AsJob
Expand Down Expand Up @@ -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',
Expand Down
21 changes: 19 additions & 2 deletions module/docs/Start-DebugAttachSession.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ Starts a new debug session attached to the specified PowerShell instance.
### ProcessId (Default)
```
Start-DebugAttachSession [-Name <String>] [-ProcessId <Int32>] [-RunspaceName <String>] [-RunspaceId <Int32>]
[-ComputerName <String>] [-AsJob] [<CommonParameters>]
[-ComputerName <String>] [-WindowActionOnEnd {Close | Hide | Keep}] [-AsJob] [<CommonParameters>]
```

### CustomPipeName
```
Start-DebugAttachSession [-Name <String>] [-CustomPipeName <String>] [-RunspaceName <String>]
[-RunspaceId <Int32>] [-ComputerName <String>] [-AsJob] [<CommonParameters>]
[-RunspaceId <Int32>] [-ComputerName <String>] [-WindowActionOnEnd {Close | Hide | Keep}] [-AsJob]
[<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -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.
Copy link
Preview

Copilot AI Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation states that Keep is the default value, but the parameter definition shows Default value: None. This inconsistency should be corrected - either update the parameter definition to show Keep as the default or clarify that None means the system default behavior.

Copilot uses AI. Check for mistakes.


```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).

Expand Down
Loading