Hi,
this is not an issue but an improvement suggestion.
In Visual Studio, I always heavily relied on switch statement autocompletion with enums. As far as I understood, this cannot be done with snippets currently.
Example:
enum teams {
red,
blue
}
teams team;
//I type
switch (team) -> Press Tab
Shoudl autocomplete to
switch (team) {
case teams.red:
break;
case team.blue:
break;
Thank you very much!
Thanks for the request. Yes, this is very difficult to do with VS Code's snippets today.
agreed! I'm a longtime Visual Studio w/ReSharper user in the process of converting to VSCode and really, _really_, _really_ miss this feature in VSCode.
any chance you can elaborate on what the challenges are in case someone else wants to contribute?
I too really, really miss this feature :(
Absolutely please add this
@DustinCampbell will this issue be addressed by the upcoming Completion Service PR?
@TheRealPiotrP: No. This is a code snippets feature.
Will it be added? I really miss this feature
Please add this, but if it can't be done as a snippet can it be done some other way, like generate the statement in the clipboard so I can manually paste...
This is a great idea. However, I wouldn't recommend this as a snippet, but rather as a code action. A code action is the little lightbulb that pops up, or the menu you get when you press Ctrl + ..
I rarely need to be able to tab-complete an enum. I don't need that kind of speed. But typing out an enum, and pressing Ctrl + . and then selecting "Populate enum variants" or something would be quite sufficient. Not to mention it would work on a switch statement that's already partially filled out -- for example, if a new option has been added to an enum.
This does work in Visual Studio...
I really like this too in VSCode
You can invoke this from the fixes menu when your cursor is on the switch keyword

after

If that is implemented now then this issue is probably closable. There was nothing like that before.
Which version of omnisharp-vscode has this been implemented in? I'm using 1.21.9 and can't seem to make it work.
@yogster I have "OmniSharp: Enable Roslyn Analyzers" enabled but not sure if that is necessary.
@JoeRobich That did the trick! Thanks for the tip.
Most helpful comment
agreed! I'm a longtime Visual Studio w/ReSharper user in the process of converting to VSCode and really, _really_, _
really_ miss this feature in VSCode.