Skip to content

Feature Request: Expose parameters to the Outline View #5153

@BinaryInk

Description

@BinaryInk

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

Issue & Reproduction

First, searching through the open issues, this could be related to #3913, but I don't believe so as it doesn't matter whether the parameter declaration has attributes or not.

When creating a script using a param() block, the parameters are not included in the outline. It doesn't matter whether the parameter(s) have attributes or defined types, it doesn't appear

For example, none of the following situations result in the appearance of parameters in outline:

# As a Cmdlet:
[CmdletBinding()]
param(
  [Parameter()]
  [string]
  $MyString,

  [Parameter()]
  $MyLooselyTypedParam
)

# As a script
param(
  [string]$MyString,

  $MyLooselyTypedParam
)

# As an in-script Cmdlet:
function New-MyFunc {
  [CmdletBinding()]
  param(
    [Parameter()]
    [string]
    $MyString,

    [Parameter()]
    $MyLooselyTypedParam
  )
}

# As an in-script function:
function New-MyFunc {
  param(
    [string]$MyString,

    $MyLooselyTypedParam
}

In all of the above cases, both $MyString and $MyLooselyTypedParam are not surfaced in the Outline View in VSCode.

However, I did notice that when using a function declaration, you can get the parameters to show up in the function's definition by using the in-line parameter declaration:

function New-MyFunc([string]$MyString) {
# ...
}

Where it will show up as function My-NewFunc ([string]$MyString) even if the parameters are split into multiple lines. In any case, using an in-line function declaration isn't exactly a solution to the problem, as it is a long string in a small sidebar.


Expected Behavior

I would expect the Outline View to behave similarly as it does in other .NET languages like C#.

For instance, using the above example, the outline would look more like:

[f(x) icon] New-MyFunc
  [(x) icon] $MyString
  [(x) icon] $MyLooselyTypedParam

Ideally, the parameters would be a child of a separate parent named something like param() and begin{} process{} end{} blocks would also be represented:

[icon] param()
  [(x) icon] $MyString
  [(x) icon] $MyLooselyTypedParam
[f(x) icon] New-MyFunc
  [icon] param()
    [(x) icon] $MyNewFuncString
    [(x) icon] $MyNewFuncLooselyTypedParam
  [(x) icon] $myLocalFuncString
  [(x) icon] $myLocalFuncInt
[icon] begin
  [(x) icon] $myLocalScriptString
[(x) icon] $myLocalScriptInt

representing:

[CmdletBinding()]
param(
  [Parameter()]
  [string]
  $MyString,

  [Parameter()]
  $MyLooselyTypedParam
)

function New-MyFunc {
  [CmdletBinding()]
  param(
    [Parameter()]
    [string]
    $MyString,

    [Parameter()]
    $MyLooselyTypedParam
  )

  $myLocalFuncString = "From Earth"
  $myLocalFuncInt = 12
}

begin {
  $myLocalScriptString = "Hello World"
}

$myLocalScriptInt = 55

But just having proper support for parameters in the outline would be extremely beneficial.


Conclusion

Unfortunately, without displaying parameters, the functionality of the Outline View is very limiting and only particularly useful for either a.) small scripts or b.) poorly made scripts that don't leverage the features of PowerShell that make it better than shell scripts (or actively work around intended usage, e.g., by applying parameters to variables according to argument position like a bash/shell script).

PowerShell Version

$PSVersionTable; $Host

Name                           Value
----                           -----
PSVersion                      7.5.0
PSEdition                      Core
GitCommitId                    7.5.0
OS                             Arch Linux
Platform                       Unix
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          : 2025.0.0
InstanceId       : e8d9e3f0-3500-4140-8739-f7f403df2d5f
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

code --version

1.98.0
6609ac3d66f4eade5cf376d1cb76f13985724bcb
x64

Extension Version

code --list-extensions --show-versions --profile 'Shell Scripting' | Select-String powershell

ms-vscode.powershell@2025.0.0

Steps to Reproduce

See primary description outlining the issue; reproduction only requires the use of basic PowerShell features such as function and param().

Visuals

N/A

Logs

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-UIFeature: VS CodeRequest to use or implement a VS Code feature.Issue-EnhancementA feature request (enhancement).Up for GrabsWill shepherd PRs.VerifiedThis issue has been determined to be a legitimate issue that requires a fix.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions