c++visual-studiovisual-assist

Switch autocompletion for enum in Visual Assist or Vanilla Visual Studio


Is there anyway to have a switch expand with all the values of an enum using Visual Assist or Vanilla Visual Studio?. The included snipsets just insert a basic switch with just a default entry. I'm using last visual studio 2013 update.


Solution

  • VS 2013 can build a switch statement for an enum using a default snippet. (Note: use a default VS snippet, not a VA Snippet.)

    As you type "swit", accept the suggested code snippet from VS. Replace "switch_on" with your enum and press Enter. Your statement will expand. (You need two Enters if one selected your enum from a listbox.)

    select the default VS snippet for switch