Support unloaded enums and classes in Intellisense
See original GitHub issueVSCode Version: 1.40.1 OS Version: Windows 10, 1903 Powershell Extension: 2019.11.0
Steps to Reproduce:
Create an Enum Create a function which references that Enum as a parameter. Call that function, there will be no autosense when populating the parameters and values for said function.
Simple Example
Enum AzureSqlEdition
{
Standard
Premium
Basic
}
function functAutoSenseBroke
{
param
(
[Parameter(Mandatory=$True)][AzureSqlEdition]$DbType,
[Parameter(Mandatory=$True)][string]$OtherParameter
)
Write-Host $DbType
Write-Host $OtherParameter
}
function functAutoSenseWorks
{
param ( [Parameter(Mandatory=$True)][string]$DbType )
Write-Host $DbType
}
#works but no autosense
functAutoSenseBroke -DbType ([AzureSqlEdition]::Standard) -OtherParameter "other"
#Simple Function, no Enum, autosense works, for comparison purposes
functAutoSenseWorks -DbType "test"
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
Can I order the enum values in intellisense? - Stack Overflow
Is it possible to tell intellisense to order them the way I want? public enum numbers { zero, one, two, three, four }....
Read more >Intellisense breaks completely on C++ 20 modules when ...
The root cause seems to be class members that are of enum type. If I remove the fields that are enums from my...
Read more >Interfaces and enums - MSDN - Microsoft
I have some auto generated code where I create static classes that encapsulate some methods. The methods all take some variation of ...
Read more >C++11: Non-intrusive enum class with Reflection support ...
Another thing that you may want to change is the compatibility workaround that is used when no enum classes are available. It is...
Read more >Group Your Constants and Enums | Blog - Ardalis
Empty ; // static readonly values work, too } // other static class groupings }. When you reference this code, again you'll get...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Yeah completion acts differently when the source is also in the text it’s trying to complete for. If you:
Then it’ll probably act same. A very similar issue is PowerShell/PowerShell#10567. This is something that needs to be corrected in PowerShell itself (the engine provides the API that does all of vscode-powershell’s completions)
Closing as an external fix in PowerShell https://github.com/PowerShell/PowerShell/issues/12079