Skip to content

Auto-completion of property names fails when capturing output from Out-GridView command #5055

@pcgeek86

Description

@pcgeek86

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

When a variable captures output, that is being piped through the Out-GridView command, the VSCode PowerShell extension is unable to auto-complete the property names from that variable.

The declared [OutputType()] seems to get "lost" from the Get-AzStorageAccount command, when it's piped through Out-GridView. Is there a way to preserve this?

PowerShell Version

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

Name             : Visual Studio Code Host
Version          : 2024.2.2
InstanceId       : 652c5855-aad9-4300-a9bd-6f429676af8d
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

Visual Studio Code Version

1.93.1
38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40
x64

Extension Version

ms-vscode.powershell@2024.2.2

Steps to Reproduce

  1. Use code block below
  2. Try to auto-complete the property name on line 2 (CTRL + SPACE after period)
  3. It fails
  4. Remove the pipe to Out-GridView
  5. Try auto-completing the property name on line 2 again
  6. It works
  7. See video reproduction below
$SelectedStorageAccount = Get-AzStorageAccount | Out-GridView -Title 'Select an Azure Storage Account' -OutputMode Single
$SelectedStorageAccount.ResourceGroupName

Visuals

2024-10-02.10-50-10.mp4

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions