powershellvisual-studio-codebreadcrumbs

Breadcrumb doesn't parse collection variable properties


I wanted to confirm whether the following is a bug or expected behaviour, before I submit anything to VS Code on GitHub.

I have a PowerShell script I'm working on thas has a few script level variables. Some of them are Hashtables with several properties each declared in block style:

$Script:VarOne = [ordered]@{
    FirstProperty = ""
    SecondProperty = ""
}

I noticed that the breadcrumbs section (right under the file name in the editor) will follow correctly when I'm on the line with the variable name. But, when my cursor is on any of the property lines, the variable name disappears from the breadcrumb. I took two screenshots to demonstrate:

In this one, my cursor is on line 99. The breadcrumb shows three folders, the script, and finally the variable. Screenshot of breadcrumb showing variable name

In this one, my cursor in on line 100. The breadcrumb only shows the three folders and the script. Screenshot of breadcrumb not showing variable name

Has anyone else encountered this?

Thanks in advance.

ETA: Retook the screenshots and highlighted the difference between them. Also added the two-sentence captions above the screenshots.


Solution

  • I can't give you a design rationale, but I can describe the de-facto logic of how the PowerShell extension for Visual Studio Code manages its intra-script breadcrumb display:


    It follows that, in an assignment statement, if you place the cursor anywhere on the RHS, i.e. anywhere from the = symbol (or preceding whitespace) to the end of the value being assigned, you'll merely see the breadcrumb representing the enclosing scope: