Open DarkLite1 opened 5 years ago
@DarkLite1 do other IDE features continue to work after you hit this? e.g. do you continue to get completions for other things?
@DarkLite1 thanks for reporting this...interestingly the editor and terminal are using the same API so it could be a performance reason as to why the parameters are not loading
It would be really helpful if you could also attach the logs--instructions for how to do that are here and please use diagnostic logging "powershell.developer.editorServicesLogLevel": "Diagnostic"
@rjmholt when this happens and I try another function to complete in the editor pane, like type Get-Pr
hit CTRL+I
and expect it to complete to Get-Process
, it wont work anymore. When intellisense is invoked it keeps showing the text Loading...
but nothing happens.
@SydneyhSmith you can find the logs here: logs.zip
Notice that on the first try the function executed intellisense correctly, the second time I tried it it kept showing the text Loading...
and nothing happened.
This is strange... When I try it manually it works fine, like this:
Function Test-Stuff {
Param (
[Parameter(Mandatory, ValueFromPipeline)]
[Object[]]$Ticket,
[Switch]$PassThru
)
DynamicParam {
$EnvCustomAttribute = New-Object System.Management.Automation.ParameterAttribute
$EnvCustomAttribute.Position = 0
$EnvCustomAttribute.Mandatory = $true
$EnvAttributeCollection = New-Object System.Collections.ObjectModel.Collection[System.Attribute]
$EnvAttributeCollection.Add($EnvCustomAttribute)
$EnvAttribValidateSet = New-Object System.Management.Automation.ValidateSetAttribute(@('Test', 'Prod', 'Stage', 'Dev'))
$EnvAttributeCollection.Add($EnvAttribValidateSet)
$EnvEnvironmentParam = New-Object System.Management.Automation.RuntimeDefinedParameter(
'Environment', [String], $EnvAttributeCollection)
$TypeCustomAttribute = New-Object System.Management.Automation.ParameterAttribute
$TypeCustomAttribute.Position = 0
$TypeCustomAttribute.Mandatory = $true
$TypeAttributeCollection = New-Object System.Collections.ObjectModel.Collection[System.Attribute]
$TypeAttributeCollection.Add($TypeCustomAttribute)
$TypeAttribValidateSet = New-Object System.Management.Automation.ValidateSetAttribute(@('Incident', 'Request', 'Project'))
$TypeAttributeCollection.Add($TypeAttribValidateSet)
$TypeEnvironmentParam = New-Object System.Management.Automation.RuntimeDefinedParameter(
'Type', [String], $TypeAttributeCollection)
$ParamDictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary
$ParamDictionary.Add('Environment', $EnvEnvironmentParam)
$ParamDictionary.Add('Type', $TypeEnvironmentParam)
$ParamDictionary
}
Process {
'yes'
}
}
But when I use the example code from my first post with DynamicParams created by the function it doesn't work as desired in vscode, but it does in PowerShell ISE:
So somewhere there's a difference in the dynamic parameters that make intellisense crash.
I made an export of both dynamic parameters, one that is generated by the function and one that is made manually. This will allow someone with more knowledge to see what the difference in them is and why intellisense doesn't work in vscode
but does in the PowerShell ISE
for the dynamic parameters generated by the function.
@DarkLite1 based on your response, I suspect you're hitting https://github.com/PowerShell/PowerShellEditorServices/issues/762#issuecomment-428756484. @SeeminglyScience might have some insight there.
This is something we don't have much control over; the fix lies in PackageManagement, but we're investigating how to fix it since it also affects PSScriptAnalyzer
@DarkLite1 based on your response, I suspect you're hitting PowerShell/PowerShellEditorServices#762 (comment). @SeeminglyScience might have some insight there.
Yeah the OP doesn't hang for me, so there's a good chance it's related.
This issue is being closed as inactive, if this issue is still occurring it will be re-opened
Bot is trigger happy...
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:
The function `New-DynamicParamter' can be downloaded here.
-Type
)Terminal
or in the editor of thePowerShell ISE
.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.