PowerShell / PowerShell/vscode-powershell

Intellisense not working when more than one DynamicParameter is used

Abierto
#2,117 10 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Area-Script Analysis Issue-Bug
Lenguaje dominante
TypeScript
Estrellas
1.9k
Forks
548
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Reproduce el ejemplo de DynamicParam en el panel del editor de VS Code y compara el comportamiento del autocompletado con el Terminal integrado y PowerShell ISE. Se considera terminado cuando IntelliSense sugiere ambos parámetros dinámicos, incluido -Type, sin quedarse atascado indefinidamente en la carga.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
powershell, typescript, vscode
Área
developer-experience, tooling
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.