Did you know... How to change default values and variables in a code snippet - #104
When you insert a code snippet, the editor highlights the fields (variables, values, etc) you can modify depending on how the code snippet was written. The idea is you modify the contents of the field, 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 undo to get back to those highlighted fields. You would have to use your favorite refactoring method to make any additional updates. I call this out because I always press enter when i meant to hit tab. No idea why this got hard-coded into my head, so just a heads-up.
For those of you who found this tip outside the tip of the day series, you can read more about code snippets on the VS Editor Team Blog .
Technorati tags: VS2005Tip, VS2008Tip
Comments
Anonymous
December 11, 2007
You should replace the # sign in those images to %23 instead. The sharp sign won't work in IEAnonymous
December 11, 2007
PingBack from http://0d1.info/ford/2007/12/11/did-you-know-how-to-change-default-values-and-variables-in-a/Anonymous
December 11, 2007
Is it just me, or are the screen shots not coming through? The last two tips have not had images. Clicking on the image takes me to a page that says the image isn't found. http://blogs.msdn.com/blogfiles/saraford/WindowsLiveWriter/Did.Howtochangedefaultvaluesandvariables_9E2C/CodeSnippetsC#_2.jpgAnonymous
December 11, 2007
Hmm, this is not good. I'll investigate tonight what is going on with the screen shots.Anonymous
December 11, 2007
or i could just read Dennis's comment above! =) As soon as I get a free second, i'll update the images. I was worried for a second there.Anonymous
December 11, 2007
Okay, all of the images are fixed now, including the ones for the rest of the week. Thanks!Anonymous
March 18, 2009
Когда вы вставляете шаблон кода, редактор подсвечивает поля (переменные, значения и т.п.), которые вы