Skip to content

Commit ea6e3f8

Browse files
committed
review on staging
1 parent 7edaeff commit ea6e3f8

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed
Loading

docs/ide/walkthrough-creating-a-code-snippet.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ The following XML is the basic snippet template:
7373

7474
5. Save the snippet as *SquareRoot.snippet* (you can save it anywhere).
7575

76-
## Add a code snippet to Visual Studio
76+
## Import a code snippet
7777

78-
1. You can add your own snippets to your Visual Studio installation by using the **Code Snippets Manager**. Open it by choosing **Tools** > **Code Snippets Manager**.
78+
1. You can import a snippet to your Visual Studio installation by using the **Code Snippets Manager**. Open it by choosing **Tools** > **Code Snippets Manager**.
7979

8080
2. Click the **Import** button.
8181

@@ -118,7 +118,7 @@ The following XML is the basic snippet template:
118118
::: moniker-end
119119

120120
> [!TIP]
121-
> Since we're editing the file in the directory where Visual Studio placed it, we don't need to reimport it to Visual Studio.
121+
> Since you're editing the file in the directory where Visual Studio placed it, you don't need to reimport it to Visual Studio.
122122
123123
2. Add **Author** and **Description** elements to the **Header** element, and fill them in.
124124

@@ -134,6 +134,8 @@ The following XML is the basic snippet template:
134134

135135
4. Open the **Code Snippets Manager** and select your code snippet. In the right pane, notice that the **Description** and **Author** fields are now populated.
136136

137+
![Code snippet description in Code Snippet Manager](media/code-snippet-description-author.png)
138+
137139
5. To add a shortcut, add a **Shortcut** element within the **Header** element:
138140

139141
```xml
@@ -147,7 +149,7 @@ The following XML is the basic snippet template:
147149

148150
6. Save the snippet file again.
149151

150-
7. To test the shortcut in the project you used previously, type **sqrt** in the editor and press **Tab** (once for Visual Basic, twice for C#).
152+
7. To test the shortcut, open the project you used previously, type **sqrt** in the editor and press **Tab** (once for Visual Basic, twice for C#).
151153

152154
The snippet code is inserted.
153155

@@ -172,6 +174,12 @@ You may want parts of a code snippet to be replaced by the user. For example, yo
172174
</Snippet>
173175
```
174176

177+
Notice that the literal replacement is given an ID (`Number`). That ID is referenced from within the code snippet by surrounding it with `$` characters:
178+
179+
```xml
180+
<![CDATA[double root = Math.Sqrt($Number$);]]>
181+
```
182+
175183
2. Save the snippet file.
176184

177185
3. Open a project and insert the snippet.

0 commit comments

Comments
 (0)