Skip to content

Instantly share code, notes, and snippets.

@tayyebi
Last active January 5, 2021 18:05
Show Gist options
  • Save tayyebi/229a0361446d85746147f0b78425f9aa to your computer and use it in GitHub Desktop.
Save tayyebi/229a0361446d85746147f0b78425f9aa to your computer and use it in GitHub Desktop.
Xml Comment (Microsoft Standard) Snippet for codes documentation.
{
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"comment_header": {
"prefix": "comment_header",
"body": [
"/***********************************************************************"
," FILENAME: $1 DESIGN REF: $2"
,""
," DESCRIPTION:"
," $3"
,""
," DESCRIPTION PERSIAN:"
," "
,""
," PUBLIC FUNCTIONS:"
," $4 $5"
," $6 $7"
,""
," NOTES:"
," $8"
,""
," Copyright $9 $11, $10. All rights reserved."
,""
," AUTHOR : Mohammad R. Tayyebi (smile@tyyi.net) / START_DATE : $12 $13 $11"
,""
," OTHER AUTHORS:"
," "
," CHANGES:"
," REF NO VERSION DATE WHO DETAIL"
,""
," $14/$15 $16 $17 $18 $19"
,""
,"***********************************************************************/"
],
"description": "Header comment snippet"
},
"comment_func": {
"prefix": "comment_func",
"body": [
"/// *** FUNCTION_COMMENT:BEGIN ***"
,"/// AUTHOR/DATE:"
,"/// Mohammad R. Tayyebi, $1"
,"///"
,"/// OUTPUT:"
,"/// OUTPUT_TYPE: $2"
,"/// OUTPUT_DESCRIPTION: $3"
,"///"
,"/// LOGIC IN PLAIN ENGLISH:"
,"/// $4"
,"///"
,"/// LOGIC IN NON-DIFFICULT PERSIAN:"
,"/// $5"
,"///"
,"/// *** FUNCTION_COMMENT:END ***"
],
"description": "Function comment snippet"
},
"comment_block": {
"prefix": "comment_block",
"body": [
"// LOGIC IN PLAIN ENGLISH:"
,"// $2"
,"// LOGIC IN NON-DIFFICULT PERSIAN:"
,"// $3"
,"#region $1"
,"$4"
,"#endregion"
],
"description": "Block comment snippet"
}
}
{
// based on
// https://docs.microsoft.com/en-us/dotnet/csharp/codedoc#:~:text=XML%20documentation%20comments%20are%20a,can%20be%20distributed%20alongside%20your%20.
// and
// https://code.visualstudio.com/docs/editor/userdefinedsnippets
// ***
// Check out <DocumentationFile>myProject.xml</DocumentationFile> in csproj file for the result output.
"Region": {
"prefix": "region ${1}",
"body": [
"#region"
,"$TM_SELECTED_TEXT"
,"#endregion"
],
},
"Summary": {
"prefix": "comment_summary",
"body": [
"/// <summary>"
,"/// The main <c>${TM_FILENAME/(.*)\\..+$/${1:/upcase}/}</c> class."
,"/// </summary>"
],
"description": "The <summary> tag is important, and we recommend that you include it because its content is the primary source of type or member information in IntelliSense or an API reference document."
},
"Class": {
"prefix": "comment_class",
"body": [
"/// <summary>"
,"/// The main <c>${TM_FILENAME/(.*)\\..+$/${1:/upcase}/}</c> class."
,"/// Contains all methods for performing basic math functions."
,"/// <list type=\"bullet\">"
,"/// <item>"
,"/// <term>${2:Multiply}</term>"
,"/// <description>${3:Multiplication Operation}</description>"
,"/// </item>"
,"/// </list>"
,"/// </summary>"
,"/// <remarks>"
,"/// <para>${3:This class can add, subtract, multiply and divide.}</para>"
,"/// </remarks>"
],
},
"Function": {
"prefix": "comment_function",
"body": [
"/// <summary>"
,"/// <para>${1:Adds two integers and returns the result.}</para>"
,"/// ${2:<para>See <see cref=\"Math.Min(double, double)\"/>"
,"///to find minimum between <paramref name=\"${7:a}\"/> and <paramref name=\"${9:b}\"/>.</para>}"
,"/// <seealso cref=\"${3:AnotherClass.cs}\"/>"
,"/// </summary>"
,"/// <returns>"
,"/// ${4:The sum of two integers.}"
,"/// </returns>"
,"/// <exception cref=\"${5:System.OverflowException}\">Thrown when ${6:param is nill}</exception>"
,"/// <param name=\"${7:a}\">${8:A double precision number.}</param>"
,"/// <param name=\"${9:b}\">${10:A double precision number.}</param>"
,"/// ${10:<typeparam name=\"T\">A type that inherits from the IComparable interface.</typeparam>}"
,"/// <example>"
,"/// <code>"
,"/// ${3:int c = Math.Add(4, 5);}"
,"/// </code>"
,"/// </example>"
]
},
"Author/Date":{
"prefix": "comment_author",
"body": [
"/// <author>${0:Tayyebi, Mohammad R.}, ${2:smile@tyyi.net}"
,"/// <start_date>${10:$CURRENT_DATE $CURRENT_MONTH_NAME_SHORT $CURRENT_YEAR}</start_date></author>"
],
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment