microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.46k stars 1.53k forks source link

Switch Case Snippet #5919

Open hacantorcooke opened 4 years ago

hacantorcooke commented 4 years ago

Hey all,

Really enjoying the extension so far! I have a small feature request that is hopefully only a couple of minutes to implement!

When coding in C, a pretty common pattern is a switch case that covers all enum values such as:

switch(enum)
{
    case ENUM_VALUE_1:
        break;
    case ENUM_VALUE_2:
        break;
    .......
    default:
        break;
}

It would seem that intellisense already has most of the info to do this, so making a snippet that auto-generates a switch case like this given an enum would be great. From what I could tell from code-snippets, they don't give a way to introspect input variable info, so I was not able to make a user snippet to do this.

Thanks!

bobbrow commented 4 years ago

I think this is a great idea. Unfortunately it will take more than a couple of minutes to implement 😉 We have to prioritize this against other bugs and feature requests on our backlog, but we will update the Milestone when it is selected into an official release.