The Wayback Machine - https://web.archive.org/web/20201005204159/https://github.com/PowerShell/vscode-powershell/issues/2982
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValidateSet/Register-ArgumentCompleter/Enum completions does not work correctly #2982

Open
PrzemyslawKlys opened this issue Oct 1, 2020 · 2 comments

Comments

@PrzemyslawKlys
Copy link

@PrzemyslawKlys PrzemyslawKlys commented Oct 1, 2020

Issue Description

I am experiencing a problem with... completions failing for 2nd entry.

ThisWayWeird

Notice that it works on 14th line, and then very same command fails on line 10th.

function Get-GPOZaurrPermissionSummary {
    [cmdletBinding()]
    param(
        [validateSet('AuthenticatedUsers', 'DomainComputers', 'Unknown', 'WellKnownAdministrative', 'NotWellKnown', 'NotWellKnownAdministrative', 'NotAdministrative', 'Administrative', 'All')][string[]] $Type = 'All',
        [validateSet('Allow', 'Deny', 'All')][string] $PermitType = 'All',
        [ValidateSet('GpoApply', 'GpoEdit', 'GpoCustom', 'GpoEditDeleteModifySecurity', 'GpoRead', 'GpoOwner', 'GpoCustomCreate', 'GpoCustomOwner')][string[]] $IncludePermissionType,
        [ValidateSet('GpoApply', 'GpoEdit', 'GpoCustom', 'GpoEditDeleteModifySecurity', 'GpoRead', 'GpoOwner', 'GpoCustomCreate', 'GpoCustomOwner')][string[]] $ExcludePermissionType,
        [Microsoft.GroupPolicy.GPPermissionType[]] $Test,

        [alias('ForestName')][string] $Forest,
        [string[]] $ExcludeDomains,
        [alias('Domain', 'Domains')][string[]] $IncludeDomains,
        [System.Collections.IDictionary] $ExtendedForestInformation,

        [string] $Separator
    )

I tried to replicate it to give you reproducible code but I just can't. I'm experiencing it across all my modules and I can't pinpoint it to what I'm doing wrong. It fails the same way for both [Microsoft.GroupPolicy.GPPermissionType[]] which is an enum, but also have the same issue with ValidateSet and Register-ArgumentCompleter that makes me want to cry :-)

Attached Logs

1601583262-5511c227-6bca-4824-9bad-6f29a894ed501601499246405.zip

Follow the instructions in the README about
capturing and sending logs.

Environment Information

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.19042
VSCode 1.49.2
PowerShell Extension Version 2020.9.0

PowerShell Information

Name Value
PSVersion 5.1.19041.541
PSEdition Desktop
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.19041.541
BuildVersion 10.0.19041.541
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)
Extension Author Version
better-toml bungcip 0.3.2
csharp ms-dotnettools 1.23.2
errorlens usernamehw 3.2.2
github-linker gimenete 0.2.3
gitlens eamodio 10.2.2
line-endings steditor 1.0.3
LogFileHighlighter emilast 2.9.0
markdown-all-in-one yzhang 3.3.0
material-icon-theme PKief 4.3.0
open-in-browser techer 2.0.0
powershell-preview ms-vscode 2020.9.0
project-manager alefragnani 11.3.0
rainbow-brackets 2gua 0.0.6
run-in-powershell tobysmith568 1.1.0
swdc-vscode softwaredotcom 2.3.12
vscode-markdownlint DavidAnson 0.37.0
vscode-toggle-quotes BriteSnow 0.3.3
vscode-wakatime WakaTime 4.0.8
vscode-yaml redhat 0.11.1
xml DotJoshJohnson 2.5.1
@SydneyhSmith
Copy link
Collaborator

@SydneyhSmith SydneyhSmith commented Oct 1, 2020

Thanks @PrzemyslawKlys for the detailed information, apologies for my confusion but can you please clarify the GIF...what are you expecting to see on line 10 that you are not seeing? Thanks!

@PrzemyslawKlys
Copy link
Author

@PrzemyslawKlys PrzemyslawKlys commented Oct 1, 2020

Notice how 2nd element for Test parameter doesnt have proper autocompletion. Its just some cache from code not autocompletion. I have this behavior for validateset, enums, and so on. It works if its single entry. As soon as i expect array of entries only first one works. But again... not always. Works fine on line 14, and on line 10 same parameter for same command gives junk on 2nd and 3rd element.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.