Steps to reproduce
function New-Function {
[cmdletBinding()]
param(
[validateSet('New', 'Old', 'Other')][string[]] $Test1,
[validateSet('New', 'Old', 'Other')][string[]] $Test2
)
}
New-Function -Test1 New -Test2 New
New-Function -Test1 New, Old -Test2 New
New-Function -Test1 New, Old -Test2 New
Paste in VSCode. Try to autocomplete Test2 parameter on line 8 (first instance in the script). It will work for 1st element of array, but if you try adding 2nd or 3rd element autocomplete fails.
It works correctly if you start from top to bottom as in
function New-Function {
[cmdletBinding()]
param(
[validateSet('New', 'Old', 'Other')][string[]] $Test1,
[validateSet('New', 'Old', 'Other')][string[]] $Test2
)
}
New-Function -Test1 New -Test2 New
It will work on line 8
function New-Function {
[cmdletBinding()]
param(
[validateSet('New', 'Old', 'Other')][string[]] $Test1,
[validateSet('New', 'Old', 'Other')][string[]] $Test2
)
}
New-Function -Test1 New -Test2 New
New-Function -Test1 New, Old -Test2 New
New-Function -Test1 New, Old -Test2 New
It will work on line 10 but fails for lines 8 and 9.

Originally reported in VSCode PowerShell extension where more discussion is present: PowerShell/vscode-powershell#2982
Expected behavior
Autocomplete working on arrays in any order. On first line, last line, middle line.
Actual behavior
Environment data
Name Value
---- -----
PSVersion 7.1.0-rc.1
PSEdition Core
GitCommitId 7.1.0-rc.1
OS Microsoft Windows 10.0.19042
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Steps to reproduce
Paste in VSCode. Try to autocomplete Test2 parameter on line 8 (first instance in the script). It will work for 1st element of array, but if you try adding 2nd or 3rd element autocomplete fails.
It works correctly if you start from top to bottom as in
It will work on line 8
It will work on line 10 but fails for lines 8 and 9.
Originally reported in VSCode PowerShell extension where more discussion is present: PowerShell/vscode-powershell#2982
Expected behavior
Autocomplete working on arrays in any order. On first line, last line, middle line.
Actual behavior
Environment data