You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ide/walkthrough-creating-a-code-snippet.md
+12-4Lines changed: 12 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -73,9 +73,9 @@ The following XML is the basic snippet template:
73
73
74
74
5. Save the snippet as *SquareRoot.snippet* (you can save it anywhere).
75
75
76
-
## Add a code snippet to Visual Studio
76
+
## Import a code snippet
77
77
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**.
79
79
80
80
2. Click the **Import** button.
81
81
@@ -118,7 +118,7 @@ The following XML is the basic snippet template:
118
118
::: moniker-end
119
119
120
120
> [!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.
122
122
123
123
2. Add **Author** and **Description** elements to the **Header** element, and fill them in.
124
124
@@ -134,6 +134,8 @@ The following XML is the basic snippet template:
134
134
135
135
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.
136
136
137
+

138
+
137
139
5. To add a shortcut, add a **Shortcut** element within the **Header** element:
138
140
139
141
```xml
@@ -147,7 +149,7 @@ The following XML is the basic snippet template:
147
149
148
150
6. Save the snippet file again.
149
151
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#).
151
153
152
154
The snippet code is inserted.
153
155
@@ -172,6 +174,12 @@ You may want parts of a code snippet to be replaced by the user. For example, yo
172
174
</Snippet>
173
175
```
174
176
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:
0 commit comments