Skip to content

powershell.integratedConsole.focusConsoleOnReadHost feature request  #4691

Open
@aksarben

Description

@aksarben

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.

Summary

In Visual Studio Code (VSC) I have set powershell.integratedConsole.focusConsoleOnExecute to true.

When debugging a PowerShell script in VSC, when execution reaches line that requests user input (e.g., Read-Host), the focus does not automatically move to the console. Instead, it remains in the editor pane, with the current debug break point line selected. If I don't notice the focus is still in the editor pane, and start typing my input, it erases the selected code line (i.e., the call to Read-Host).

PowerShell Version

PSVersion                      7.3.6
PSEdition                      Core
GitCommitId                    7.3.6
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visual Studio Code Version

code --version
1.81.0
6445d93c81ebe42c4cbd7a60712e0b17d9463e97
x64

Extension Version

code --list-extensions --show-versions | Select-String powershell

ms-vscode.powershell@2023.6.0

Steps to Reproduce

STEPS TO REPRODUCE

In a PowerShell script in Visual Studio Code, set a break point on a line that calls Read-Host.

Launch a debug session, and run to the break point.

Step over the line.

EXPECTED RESULT: Focus automatically shifts to the console so the user can provide the input.

ACTUAL RESULT: The focus stays in the editor pane. If the user doesn’t notice that the focus hasn’t moved, and starts typing, his input erases the current selection in the editor pane: In this case, the line of code with the Read-Host call.

Visuals

No response

Logs

8/8/2023 11:50:59 AM [NORMAL] - Visual Studio Code: v1.81.0 64-bit on Windows 64-bit
8/8/2023 11:50:59 AM [NORMAL] - PowerShell process started with PID: 4496
8/8/2023 11:50:59 AM [NORMAL] - Starting 'PowerShell (x64)' at: C:\Program Files\PowerShell\7\pwsh.exe
8/8/2023 11:50:59 AM [NORMAL] - PowerShell Extension: v2023.6.0
8/8/2023 11:51:02 AM [NORMAL] - Started PowerShell v7.3.6.
8/8/2023 11:51:03 AM [NORMAL] - PowerShell is up-to-date.
8/8/2023 12:24:18 PM [VERBOSE] - Settings changed, prompting to restart...
8/8/2023 12:25:00 PM [VERBOSE] - Already started.
8/8/2023 12:25:00 PM [VERBOSE] - Session status changing from 'Running' to 'Busy'.
8/8/2023 12:25:00 PM [VERBOSE] - Connecting to pipe: \.\pipe\PSES_r0oi1aqw.m3t
8/8/2023 12:25:00 PM [VERBOSE] - Debug configuration: {
"name": "PowerShell: Launch Current File",
"type": "PowerShell",
"request": "launch",
"script": "C:\Users\Dick\Documents\WebPublisher\WebPublisher.ps1",
"args": [
"set-client-root"
],
"__configurationTarget": 6,
"internalConsoleOptions": "neverOpen",
"createTemporaryIntegratedConsole": false
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions