Skip to content

Commit bf21363

Browse files
committed
Add WindowActionOnEnd for Start-DebugAttachSession
Adds the parameter `-WindowActionOnEnd` that corresponds to the new VSCode attach configuration option `temporaryConsoleWindowActionOnDebugEnd`.
1 parent 79ff7dd commit bf21363

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

module/PowerShellEditorServices/Commands/Public/Start-DebugAttachSession.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ function Start-DebugAttachSession {
3838
[string]
3939
$ComputerName,
4040

41+
[Parameter()]
42+
[ValidateSet('Close', 'Hide', 'Keep')]
43+
[string]
44+
$WindowActionOnEnd,
45+
4146
[Parameter()]
4247
[switch]
4348
$AsJob
@@ -127,6 +132,10 @@ function Start-DebugAttachSession {
127132
$configuration.runspaceName = $RunspaceName
128133
}
129134

135+
if ($WindowActionOnEnd) {
136+
$configuration.temporaryConsoleWindowActionOnDebugEnd = $WindowActionOnEnd.ToLowerInvariant()
137+
}
138+
130139
# https://microsoft.github.io/debug-adapter-protocol/specification#Reverse_Requests_StartDebugging
131140
$resp = $debugServer.SendRequest(
132141
'startDebugging',

module/docs/Start-DebugAttachSession.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ Starts a new debug session attached to the specified PowerShell instance.
1616
### ProcessId (Default)
1717
```
1818
Start-DebugAttachSession [-Name <String>] [-ProcessId <Int32>] [-RunspaceName <String>] [-RunspaceId <Int32>]
19-
[-ComputerName <String>] [-AsJob] [<CommonParameters>]
19+
[-ComputerName <String>] [-WindowActionOnEnd {Close | Hide | Keep}] [-AsJob] [<CommonParameters>]
2020
```
2121

2222
### CustomPipeName
2323
```
2424
Start-DebugAttachSession [-Name <String>] [-CustomPipeName <String>] [-RunspaceName <String>]
25-
[-RunspaceId <Int32>] [-ComputerName <String>] [-AsJob] [<CommonParameters>]
25+
[-RunspaceId <Int32>] [-ComputerName <String>] [-WindowActionOnEnd {Close | Hide | Keep}] [-AsJob]
26+
[<CommonParameters>]
2627
```
2728

2829
## DESCRIPTION
@@ -190,6 +191,22 @@ Accept pipeline input: False
190191
Accept wildcard characters: False
191192
```
192193

194+
### -WindowActionOnEnd
195+
196+
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.
197+
198+
```yaml
199+
Type: String
200+
Parameter Sets: (All)
201+
Aliases:
202+
203+
Required: False
204+
Position: Named
205+
Default value: None
206+
Accept pipeline input: False
207+
Accept wildcard characters: False
208+
```
209+
193210
### CommonParameters
194211
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).
195212

0 commit comments

Comments
 (0)