Skip to content

Display variable's type name #72

@rkeithhill

Description

@rkeithhill

Visual Studio uses a three column grid to display a variable's name, value and type name. In VSCode we have a tree view and the tool window it is in is typically narrow. It is common to display variable name followed by its value. However PowerShell quite often has objects (composite variables) where the current variables display shows no value for objects.

I propose is that for expandable objects, we take advantage of the opportunity to display something. One option is the variable's short type name e.g.:

vscodevariabletypenames1

Of course since we've chosen to prefix variables with $ then perhaps we display type names using PowerShell syntax:
vscodevariabletypenames2

Another variation is to test the expandable object's ToString() return and if it is different than the type name, then display that instead. Here's an example of where this is useful. I can see the useful value of $pwd without having to open the node:
vscodevariabletypenames3
In this case, I think seeing the path (ToString() value) is more useful than seeing [PathInfo].

What are your thoughts on this? The implementation is a trivial change to VariableDetails.cs. Personally, I'm leaning towards the last example of using either the type name or ToString() if it is different.

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