Skip to content

Tip 2.42: How to change default values and variables in a code snippet

October 20, 2014

“Visual Studio Tips, 251 ways to improve your Productivity, in Visual Studio“, courtesy of ‘Sara Ford’

Sara Ford’s Blog

When you insert a code snippet, the editor highlights the fields (variables, values, and so on) you can modify depending on how the code snippet was written. The idea is you modify the contents of the field and then press Tab to navigate to the next field. When you press Tab, that particular field is updated throughout the entire snippet. You can also navigate outside the field via the arrow keys to invoke the update.

If you press Enter, however, you will be committing both the current change (if any) and the entire snippet, meaning you can’t use undo to get back to those highlighted fields. You would have to use your favorite refactoring method to make any additional updates.

Happy Programming! =)

Leave a Comment

Leave a comment