question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support unloaded enums and classes in Intellisense

See original GitHub issue

VSCode 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:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
SeeminglySciencecommented, Nov 19, 2019

Yeah completion acts differently when the source is also in the text it’s trying to complete for. If you:

  1. Copy the whole script
  2. Paste it into a PSReadLine prompt without hitting enter or running any of the lines
  3. Put your cursor on the same spot and press tab

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)

0reactions
SydneyhSmithcommented, Mar 17, 2020

Closing as an external fix in PowerShell https://github.com/PowerShell/PowerShell/issues/12079

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found