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/code-snippets-schema-reference.md
+25-24Lines changed: 25 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,8 @@ Code snippets are preauthored pieces of code that are ready to insert into your
19
19
20
20
This article provides a reference to the Visual Studio IntelliSense Code Snippet XML schema. You can use the schema to create your own code snippets and add them to the code snippets that Visual Studio already includes.
21
21
22
-
For more information on creating code snippets, see [Walkthrough: Create a code snippet in Visual Studio](walkthrough-creating-a-code-snippet.md). For information about the code snippets that Visual Studio includes by default, see [C# code snippets](visual-csharp-code-snippets.md) or [Visual C++ code snippets](visual-cpp-code-snippets.md).
22
+
- For more information on creating code snippets, see [Walkthrough: Create a code snippet in Visual Studio](walkthrough-creating-a-code-snippet.md).
23
+
- For information about the code snippets that Visual Studio includes by default, see [C# code snippets](visual-csharp-code-snippets.md) or [Visual C++ code snippets](visual-cpp-code-snippets.md).
23
24
24
25
## Assembly element
25
26
@@ -150,12 +151,12 @@ Allows you to specify a heading and multiple code snippets, which you can insert
150
151
151
152
|Attribute|Description|
152
153
|---------------|-----------------|
153
-
|`Format`|*Required* attribute. Specifies the schema version of the code snippet. The `Format` attribute must be a string in the syntax of `x.x.x`, where each `x` represents a numerical value of the version number. Visual Studio ignores code snippets with `Format` attributes that it doesn't understand.|
154
+
|**Format**|*Required* attribute. Specifies the schema version of the code snippet. The **Format** attribute must be a string in the syntax of `x.x.x`, where each `x` represents a numerical value of the version number. Visual Studio ignores code snippets with **Format** attributes that it doesn't understand.|
154
155
155
156
|Child element|Description|
156
157
|-------------------|-----------------|
157
158
|[Header element](#header-element)|*Required* element. Contains general information about the code snippet. There must be exactly one `Header` element in a code snippet.|
158
-
|[Snippet element](#snippet-element)|*Required* element. Contains the code that will be inserted by Visual Studio. There must be exactly one `Snippet` element in a code snippet.|
159
+
|[Snippet element](#snippet-element)|*Required* element. Contains the code to be inserted by Visual Studio. There must be exactly one `Snippet` element in a code snippet.|
159
160
160
161
|Parent element|Description|
161
162
| - |-----------------|
@@ -266,12 +267,12 @@ Specifies general information about the code snippet.
266
267
267
268
|Child element|Description|
268
269
|-------------------|-----------------|
269
-
|[Author element](#author-element)|Optional element. The name of the person or company that authored the code snippet. There may be zero or one `Author`elements in a `Header` element.|
270
-
|[Description element](#description-element)|Optional element. A description of the code snippet. There may be zero or one `Description`elements in a `Header` element.|
271
-
|[HelpUrl element](#helpurl-element)|Optional element. A URL that contains more information about the code snippet. There may be zero or one `HelpURL`elements in a `Header` element.|
272
-
|[Keywords element](#keywords-element)|Optional element. Groups `Keyword` elements. There may be zero or one `Keywords`elements in a `Header` element.|
273
-
|[Shortcut element](#shortcut-element)|Optional element. Specifies the shortcut text that can be used to insert the snippet. There may be zero or one `Shortcut`elements in a `Header` element.|
274
-
|[SnippetTypes element](#snippettypes-element)|Optional element. Groups `SnippetType` elements. There may be zero or one `SnippetTypes`elements in a `Header` element. If there are no `SnippetTypes` elements, the code snippet is always valid.|
270
+
|[Author element](#author-element)|Optional element. The name of the person or company that authored the code snippet. There may be zero or one `Author`element in a `Header` element.|
271
+
|[Description element](#description-element)|Optional element. A description of the code snippet. There may be zero or one `Description`element in a `Header` element.|
272
+
|[HelpUrl element](#helpurl-element)|Optional element. A URL that contains more information about the code snippet. There may be zero or one `HelpURL`element in a `Header` element.|
273
+
|[Keywords element](#keywords-element)|Optional element. Groups `Keyword` elements. There may be zero or one `Keywords`element in a `Header` element.|
274
+
|[Shortcut element](#shortcut-element)|Optional element. Specifies the shortcut text that can be used to insert the snippet. There may be zero or one `Shortcut`element in a `Header` element.|
275
+
|[SnippetTypes element](#snippettypes-element)|Optional element. Groups `SnippetType` elements. There may be zero or one `SnippetTypes`element in a `Header` element. If there are no `SnippetTypes` elements, the code snippet is always valid.|
275
276
|[Title element](#title-element)|*Required* element. The friendly name of the code snippet. There must be exactly one `Title` element in a `Header` element.|
276
277
277
278
|Parent element|Description|
@@ -368,7 +369,7 @@ A text value is required. The keyword for the code snippet.
368
369
369
370
## Keywords element
370
371
371
-
Groups individual `Keyword` elements. The code snippet keywords are used by Visual Studio and represent a standard way for online content providers to add custom keywords for searching or categorization
372
+
Groups individual `Keyword` elements. The code snippet keywords are used by Visual Studio and represent a standard way for online content providers to add custom keywords for searching or categorization.
372
373
373
374
```xml
374
375
<Keywords>
@@ -387,7 +388,7 @@ Groups individual `Keyword` elements. The code snippet keywords are used by Visu
387
388
388
389
## Literal element
389
390
390
-
Defines the literals of the code snippet that you can edit. The `Literal` element identifies a replacement for a piece of code that's entirely contained within the snippet, but can be customized after the snippet is inserted. For example, literal strings, numeric values, and some variable names should be declared as literals.
391
+
Defines the literals of the code snippet that you can edit. The `Literal` element identifies a replacement for a piece of code entirely contained within the snippet that can be customized after the snippet is inserted. For example, literal strings, numeric values, and some variable names should be declared as literals.
391
392
392
393
Literals and objects can't contain an `ID` element with a value of `selected` or `end`. The value `$selected$` represents selected document text to be inserted into the snippet when the snippet is invoked. `$end$` marks the location to place the cursor after the code snippet is inserted.
393
394
@@ -402,14 +403,14 @@ Literals and objects can't contain an `ID` element with a value of `selected` or
402
403
403
404
|Attribute|Description|
404
405
|---------------|-----------------|
405
-
|`Editable`|Optional `Boolean` attribute. Specifies whether or not you can edit the literal after the code snippet is inserted. The default value of this attribute is `true`.|
406
+
|**Editable**|Optional `Boolean` attribute. Specifies whether or not you can edit the literal after the code snippet is inserted. The default value of this attribute is `true`.|
406
407
407
408
|Child element|Description|
408
409
|-------------------|-----------------|
409
410
|[Default element](#default-element)|*Required* element. Specifies the literal's default value when you insert the code snippet. There must be exactly one `Default` element in a `Literal` element.|
410
-
|[Function element](#function-element)|Optional element. Specifies a function to execute when the literal receives focus in Visual Studio. There may be zero or one `Function`elements in a `Literal` element.|
411
+
|[Function element](#function-element)|Optional element. Specifies a function to execute when the literal receives focus in Visual Studio. There may be zero or one `Function`element in a `Literal` element.|
411
412
|[ID element](#id-element)|*Required* element. Specifies a unique identifier for the literal. There must be exactly one `ID` element in a `Literal` element.|
412
-
|[ToolTip element](#tooltip-element)|Optional element. Describes the expected value and usage of the literal. There may be zero or one `ToolTip`elements in a `Literal` element.|
413
+
|[ToolTip element](#tooltip-element)|Optional element. Describes the expected value and usage of the literal. There may be zero or one `ToolTip`element in a `Literal` element.|
413
414
414
415
|Parent element|Description|
415
416
| - |-----------------|
@@ -433,7 +434,7 @@ A text value is required. This text specifies a namespace that the code snippet
433
434
434
435
## Object element
435
436
436
-
Defines the objects of the code snippet that you can edit. The `Object` element identifies an item that's required by the code snippet but is defined outside of the snippet itself. For example, Windows Forms controls, ASP.NET controls, object instances, and type instances should be declared as objects. Object declarations require a type to be specified, which is done with the `Type` element.
437
+
Defines the objects of the code snippet that you can edit. The `Object` element identifies an item required by the code snippet that's defined outside of the snippet itself. For example, Windows Forms controls, ASP.NET controls, object instances, and type instances should be declared as objects. Object declarations require a type to be specified, which is done with the `Type` element.
437
438
438
439
```xml
439
440
<ObjectEditable="true/false">
@@ -447,14 +448,14 @@ Defines the objects of the code snippet that you can edit. The `Object` element
447
448
448
449
|Attribute|Description|
449
450
|---------------|-----------------|
450
-
|`Editable`|Optional `Boolean` attribute. Specifies whether or not you can edit the literal after the code snippet is inserted. The default value of this attribute is `true`.|
451
+
|**Editable**|Optional `Boolean` attribute. Specifies whether or not you can edit the literal after the code snippet is inserted. The default value of this attribute is `true`.|
451
452
452
453
|Child element|Description|
453
454
|-------------------|-----------------|
454
455
|[Default element](#default-element)|*Required* element. Specifies the literal's default value when you insert the code snippet. There must be exactly one `Default` element in a `Literal` element.|
455
-
|[Function element](#function-element)|Optional element. Specifies a function to execute when the literal receives focus in Visual Studio. There may be zero or one `Function`elements in a `Literal` element.|
456
+
|[Function element](#function-element)|Optional element. Specifies a function to execute when the literal receives focus in Visual Studio. There may be zero or one `Function`element in a `Literal` element.|
456
457
|[ID element](#id-element)|*Required* element. Specifies a unique identifier for the literal. There must be exactly one `ID` element in a `Literal` element.|
457
-
|[ToolTip element](#tooltip-element)|Optional element. Describes the expected value and usage of the literal. There may be zero or one `ToolTip`elements in a `Literal` element.|
458
+
|[ToolTip element](#tooltip-element)|Optional element. Describes the expected value and usage of the literal. There may be zero or one `ToolTip`element in a `Literal` element.|
458
459
|[Type element](#type-element)|*Required* element. Specifies the type of the object. There must be exactly one `Type` element in an `Object` element.|
459
460
460
461
|Parent element|Description|
@@ -475,7 +476,7 @@ Specifies information about the assembly references required by the code snippet
475
476
|Child element|Description|
476
477
|-------------------|-----------------|
477
478
|[Assembly element](#assembly-element)|*Required* element. Contains the name of the assembly referenced by the code snippet. There must be exactly one `Assembly` element in a `Reference` element.|
478
-
|[Url element](#url-element)|Optional element. Contains a URL that provides more information about the referenced assembly. There may be zero or one `Url`elements in a `Reference` element.|
479
+
|[Url element](#url-element)|Optional element. Contains a URL that provides more information about the referenced assembly. There may be zero or one `Url`element in a `Reference` element.|
479
480
480
481
|Parent element|Description|
481
482
| - |-----------------|
@@ -534,9 +535,9 @@ Specifies the references, imports, declarations, and code for the code snippet.
534
535
|Child element|Description|
535
536
|-------------------|-----------------|
536
537
|[Code element](#code-element)|*Required* element. Specifies the code that you want to insert into a documentation file. There must be exactly one `Code` element in a `Snippet` element.|
537
-
|[Declarations element](#declarations-element)|Optional element. Specifies the literals and objects that make up the parts of a code snippet that you can edit. There may be zero or one `Declarations`elements in a `Snippet` element.|
538
-
|[Imports element](#imports-element)|Optional element. Groups individual `Import` elements. There may be zero or one `Imports`elements in a `Snippet` element.|
539
-
|[References element](#references-element)|Optional element. Groups individual `Reference` elements. There may be zero or one `References`elements in a `Snippet` element.|
538
+
|[Declarations element](#declarations-element)|Optional element. Specifies the literals and objects that make up the parts of a code snippet that you can edit. There may be zero or one `Declarations`element in a `Snippet` element.|
539
+
|[Imports element](#imports-element)|Optional element. Groups individual `Import` elements. There may be zero or one `Imports`element in a `Snippet` element.|
540
+
|[References element](#references-element)|Optional element. Groups individual `Reference` elements. There may be zero or one `References`element in a `Snippet` element.|
540
541
541
542
|Parent element|Description|
542
543
| - |-----------------|
@@ -601,7 +602,7 @@ A text value is required. This text specifies the title of the code snippet.
601
602
602
603
## ToolTip element
603
604
604
-
Describes the expected value and usage of a literal or object in a code snippet, which Visual Studio displays in a ToolTip when it inserts the code snippet into a project. The ToolTip text is displayed when the mouse hovers over the literal or object after the code snippet has been inserted.
605
+
Describes the expected value and usage of a literal or object in a code snippet. Visual Studio displays this information in a ToolTip when it inserts the code snippet into a project. The ToolTip also displays when the mouse hovers over the literal or object after the code snippet is inserted.
605
606
606
607
```xml
607
608
<ToolTip>
@@ -618,7 +619,7 @@ A text value is required. This text specifies the ToolTip description to be asso
618
619
619
620
## Type element
620
621
621
-
Specifies the type of the object. The `Object` element is used to identify an item that's required by the code snippet but is probably defined outside of the snippet itself. For example, Windows Forms controls, ASP.NET controls, object instances, and type instances should be declared as objects. Object declarations require a type to be specified, which is done with the `Type` element.
622
+
Specifies the type of the object. The `Object` element identifies an item thatthe code snippet requires but is probably defined outside of the snippet itself. For example, Windows Forms controls, ASP.NET controls, object instances, and type instances should be declared as objects. Object declarations require a type to be specified, which is done with the `Type` element.
Copy file name to clipboardExpand all lines: docs/ide/visual-cpp-code-snippets.md
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ dev_langs:
11
11
---
12
12
# Visual C++ code snippets
13
13
14
-
In Visual Studio, you can use code snippets to add commonly-used code to your C++ code files.
14
+
In Visual Studio, you can use code snippets to add commonlyused code to your C++ code files. Code snippets can make writing program code quicker, easier, and more reliable.
15
15
16
16
## Complete list of C++ code snippets
17
17
@@ -73,7 +73,7 @@ The names of most C++ code snippets are self-explanatory, but some names might b
73
73
74
74
### Class, classi
75
75
76
-
The **class** snippet provides the definition of a class named `MyClass`. The definitions of the appropriate default constructor and destructor are located outside the class.
76
+
The `class` snippet provides the definition of a class named `MyClass`. The definitions of the appropriate default constructor and destructor are located outside the class.
77
77
78
78
```cpp
79
79
classMyClass
@@ -95,7 +95,7 @@ MyClass::~MyClass()
95
95
}
96
96
```
97
97
98
-
The **classi** code snippet also provides the definition of a class named `MyClass`, but the default constructor and destructor are defined inside the class definition.
98
+
The `classi` code snippet also provides the definition of a class named `MyClass`, but the default constructor and destructor are defined inside the class definition.
99
99
100
100
```cpp
101
101
classMyClass
@@ -116,9 +116,9 @@ private:
116
116
117
117
### For, forr, rfor
118
118
119
-
The three different **for** snippets provide different kinds of `for` loops.
119
+
The three different `for` snippets provide different kinds of `for` loops.
120
120
121
-
- The **rfor** snippet provides a [range-based for loop](/cpp/cpp/range-based-for-statement-cpp). This construct is preferred over index-based `for` loops.
121
+
- The `rfor` snippet provides a [range-based for loop](/cpp/cpp/range-based-for-statement-cpp). This construct is preferred over index-based `for` loops.
122
122
123
123
```cpp
124
124
for (auto& i : v)
@@ -127,7 +127,7 @@ The three different **for** snippets provide different kinds of `for` loops.
127
127
}
128
128
```
129
129
130
-
- The **for** snippet provides a `for` loop in which the condition is based on the length of an object in `size_t`.
130
+
- The `for` snippet provides a `for` loop in which the condition is based on the length of an object in `size_t`.
131
131
132
132
```cpp
133
133
for (size_t i = 0; i < length; i++)
@@ -136,7 +136,7 @@ The three different **for** snippets provide different kinds of `for` loops.
136
136
}
137
137
```
138
138
139
-
- The **forr** snippet provides a reverse `for` loop in which the condition is based on the length of an object in integers.
139
+
- The `forr` snippet provides a reverse `for` loop in which the condition is based on the length of an object in integers.
140
140
141
141
```cpp
142
142
for (int i = length - 1; i >= 0; i--)
@@ -147,7 +147,7 @@ The three different **for** snippets provide different kinds of `for` loops.
147
147
148
148
### The destructor snippet (~)
149
149
150
-
The destructor snippet **~** shows different behavior in different contexts. If you insert this snippet inside a class, it provides a destructor for that class.
150
+
The destructor snippet `~` shows different behavior in different contexts. If you insert this snippet inside a class, it provides a destructor for that class.
151
151
152
152
For example, if you insert the destructor snippet inside a class named `SomeClass`, it provides a destructor for `SomeClass`.
0 commit comments