Hi,
Not a bug, but a feature request please. Have been asked to post feature request here.
Version Used:
N/A
Steps to Reproduce:
Expected Behavior:
Like C#, enum values to be auto-listed as cases.
let status: StatusETW = etw.EtwStatusId as StatusETW;
switch (status) {
case StatusETW.Cancelled:
break;
case StatusETW.Completed:
break;
case StatusETW.Draft:
break;
case StatusETW.EligibleToWork:
break;
case StatusETW.Expired:
break;
case StatusETW.UnComplete:
break;
case StatusETW.Unlock:
break;
default:
break;
}
Actual Behavior:
This happens:
let status: StatusETW = etw.EtwStatusId as StatusETW;
switch (status) {
default:
}
Kind Regards.
That would be very nice to have in VSCode, too!
vs implment this uses snippet. https://docs.microsoft.com/en-us/visualstudio/ide/code-snippet-functions?view=vs-2019
But I think this should be a codeaction in typescript.
switch(expr)
{
default:
}
When cursor at switch or expr , and if expr's type is an enum type and empty switch body, should enable the code action to generate all enum cases.
Here enum means real enum type or union type like 'A'|'B'|1|true|null.
Finally, I have made this.

https://marketplace.visualstudio.com/items?itemName=heroboy.generate-switch-case-for-enum-type
Finally, I have made this.
https://marketplace.visualstudio.com/items?itemName=heroboy.generate-switch-case-for-enum-type
Very well done indeed!
@TypeScript team, pretty please :)
Most helpful comment
Finally, I have made this.

https://marketplace.visualstudio.com/items?itemName=heroboy.generate-switch-case-for-enum-type