Skip to content

Autocompletion gives no results for $PSItem / $_ in Catch blocks #7828

@vexx32

Description

@vexx32

Despite the fact that catch blocks should always receive an ErrorRecord object as the $_ or $PSItem value, there is no autocompletion / type inference performed for its properties, nor those of the Exception and/or InnerExceptions it contains.

Steps to reproduce

try {
    throw "nope"
}
catch {
    $PSItem.{tab}
}

Expected behavior

    $PSItem.CategoryInfo      # And cycle through list of ErrorRecord properties on subsequent presses

(I know there's a programmatic way to get completion results, but I'm not familiar enough with how it works to be able to put that together at present.)

Actual behavior

    $PSItem.                 # no completion results offered whatsoever

Environment data

> $PSVersionTable

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

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