This documentation is archived and is not being maintained.

Code Snippet Replaceable Parameters

When you insert a code snippet in your code, as outlined in How to: Insert IntelliSense Code Snippets, replaceable parameters in the snippet are highlighted so that you can locate them more quickly.

In earlier versions of Visual Studio, replaceable parameters remained highlighted until you closed the file.

By default, beginning in Visual Studio 2008, highlights appear only when the cursor is in the snippet. You can change this behavior so that replaceable parameters are highlighted in all snippets that you have inserted since you opened the file. To do this, right-click anywhere in the document and then click Show Snippet Highlighting, To Turn off highlighting in all snippets, right-click anywhere in the document and then click Hide Snippet Highlighting


When the parameters in all inserted snippets are highlighted and you start editing code again, the highlights will disappear in all snippets except the one that you are editing.

If you have added several snippets while a file is open and only some replaceable parameters are highlighted, then both Show Snippet Highlighting and Hide Snippet Highlighting become available. When you click either command, the highlighting behavior is the same for all replaceable parameters. Also, after you click either command, only the reverse command is available. For example, if you click Show Snippet Highlighting, then only Hide Snippet Highlighting is available.

The behavior of replaceable parameter highlighting in Visual C# and Visual Basic is the same except for the following differences:

  • After you insert a snippet in Visual C#, the first occurrence of a replaceable parameter is highlighted in color and all other instances of it in the snippet are highlighted by only a border. 

  • After you type text in a replaceable parameter in Visual C#, you can press ENTER to replace all instances of that parameter in the snippet. This action replaces all instances whether they have been modified or not. In Visual Basic, you must replace instances of a parameter one at a time.