Skip to content

Run selection with F8 causes executed code to be recalled / duplicated into the integrated console prompt #4041

Closed
PowerShell/PowerShellEditorServices
#1841
@dbrennand

Description

@dbrennand

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all 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

My vscode-powershell extension updated this morning to ms-vscode.powershell@2022.6.1 and I'm having an issue where the selection of code I'm running with F8 is executed but then is recalled immediately into the integrated console prompt.

Example:

=====> PowerShell Integrated Console v2022.6.1 <=====

PS> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.2.2
PSEdition                      Core
GitCommitId                    7.2.2
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PS> Write-Output -InputObject "Hi!"
Hi!
PS> Write-Output -InputObject "Hi!"

It's as if the console history is being immediately recalled into the console prompt without additional input.

Rolling back to ms-vscode.powershell@2022.5.1 fixes the issue:

=====> PowerShell Integrated Console v2022.5.1 <=====

PS> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.2.2
PSEdition                      Core
GitCommitId                    7.2.2
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PS> Write-Output -InputObject "Hi!"
Hi!
PS>

The latest preview extension ms-vscode.powershell-preview@2022.6.2 exhibits the same behaviour as v2022.6.1.

Could this be caused by PowerShell/PowerShellEditorServices#1823?

PowerShell Version

PS> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.2.2
PSEdition                      Core
GitCommitId                    7.2.2
OS                             Microsoft Windows 10.0.19042
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

PS> code --version
1.68.1
30d9c6cd9483b2cc586687151bcbcd635f373630
x64

Extension Version

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

ms-vscode.powershell@2022.6.1
ms-vscode.powershell-preview@2022.6.2

Steps to Reproduce

Write-Output -InputObject "Hi!"
  1. With ms-vscode.powershell@2022.6.1 installed, launch the PowerShell integrated console.
  2. Select line(s) of code in the editor window and run using F8.
  3. The code is executed.
  4. The executed lines of code are recalled immediately into the integrated console prompt.

Visuals

No response

Logs

No response

Metadata

Metadata

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions