Skip to content

Intellisense not working when more than one DynamicParameter is used #2117

Open
@DarkLite1

Description

@DarkLite1

Version: 1.37.0-insider (user setup)
Commit: 92da68a71cfb60bd3b9b0d7fbfb2a7e1fff9dbaf
Date: 2019-08-01T05:37:54.848Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 6.2.9200

Steps to Reproduce:

Consider the following example function:

Function Test-Stuff {
    Param (
        [Parameter(Mandatory, ValueFromPipeline)]
        [Object[]]$Ticket,
        [Switch]$PassThru
    )
    DynamicParam {
        $DynamicParameters = @(
            @{
                Name        = 'Environment'
                Type        = [Array]
                Position    = 0
                Mandatory   = $true
                ValidateSet = @('Test', 'Prod', 'Stage', 'Dev')
            }
            ,
            @{
                Name        = 'Type'
                Type        = [Array]
                Position    = 0
                Mandatory   = $true
                ValidateSet = @('Incident', 'Request', 'Project')
            }
        )
        $DynamicParameters | ForEach-Object { New-Object PSObject -Property $_ } | New-DynamicParameter
    }
    Begin {
        New-DynamicParameter -CreateVariables -BoundParameters $PSBoundParameters
    }
    Process {
        'yes'
    }
}

The function `New-DynamicParamter' can be downloaded here.

  • When using intellisense in the editor pane it keeps on loading and nothing is suggested for the second/last dynamic parameter (in this example -Type)

image

  • Observe that the same function with intellisense works fine in the Terminal or in the editor of the PowerShell ISE.

image

I was going nuts about this, because I thought my code was broken. Seems after a bit of stressing it's a bug in the editor pane. Thank you for looking at this.

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