summaryrefslogtreecommitdiff
path: root/luasnip_snippets/cs.json
diff options
context:
space:
mode:
Diffstat (limited to 'luasnip_snippets/cs.json')
-rw-r--r--luasnip_snippets/cs.json206
1 files changed, 206 insertions, 0 deletions
diff --git a/luasnip_snippets/cs.json b/luasnip_snippets/cs.json
new file mode 100644
index 0000000..17623a9
--- /dev/null
+++ b/luasnip_snippets/cs.json
@@ -0,0 +1,206 @@
+{
+ "enum": {
+ "prefix": "enum",
+ "description": "enumeration",
+ "body": "enum ${1:MyEnum} { ${2:Item} \\};"
+ },
+ "sim": {
+ "prefix": "sim",
+ "description": "static int main",
+ "body": [
+ "static int Main(string[] args)",
+ "{",
+ "\t$0",
+ "\\}"
+ ]
+ },
+ "svm": {
+ "prefix": "svm",
+ "description": "static void main",
+ "body": [
+ "static void Main(string[] args)",
+ "{",
+ "\t$0",
+ "\\}"
+ ]
+ },
+ "prop": {
+ "prefix": "prop",
+ "description": "Simple property declaration",
+ "body": "public ${1:int} ${2:MyProperty} { get; set; \\}"
+ },
+ "propfull": {
+ "prefix": "propfull",
+ "description": "Full property declaration",
+ "body": [
+ "private ${1:int} ${2:_myProperty};",
+ "",
+ "public $1 ${3:MyProperty}",
+ "{",
+ "\tget { return $2; \\}",
+ "\tset { $2 = value; \\}",
+ "\\}"
+ ]
+ },
+ "propg": {
+ "prefix": "propg",
+ "description": "Property with a private setter",
+ "body": "public ${1:int} ${2:MyProperty} { get; private set; \\}"
+ },
+ "elif": {
+ "prefix": "elif",
+ "description": "else if",
+ "body": [
+ "else if ($1)",
+ "{",
+ "\t$0",
+ "\\}"
+ ]
+ },
+ "elseif": {
+ "prefix": "elseif",
+ "description": "else if",
+ "body": [
+ "else if ($1)",
+ "{",
+ "\t$0",
+ "\\}"
+ ]
+ },
+ "switch": {
+ "prefix": "switch",
+ "description": "switch statement",
+ "body": [
+ "switch (${1:statement})",
+ "{",
+ "\tcase ${2:value}:",
+ "\t\tbreak;",
+ "",
+ "\tdefault:",
+ "\t\t$0break;",
+ "\\}"
+ ]
+ },
+ "case": {
+ "prefix": "case",
+ "description": "case",
+ "body": [
+ "case ${1:value}:",
+ "\t$2",
+ "\tbreak;"
+ ]
+ },
+ "throw": {
+ "prefix": "throw",
+ "description": "throw",
+ "body": "throw new $1Exception(\"$2\");"
+ },
+ "from": {
+ "prefix": "from",
+ "description": "LINQ syntax",
+ "body": [
+ "var ${1:seq} =",
+ "\tfrom ${2:item1} in ${3:items1}",
+ "\tjoin ${4:item2} in ${5:items2} on $2.${6:prop1} equals $4.${7:prop2}",
+ "\tselect ${8:$2.prop3}",
+ "\twhere ${9:clause}"
+ ]
+ },
+ "da": {
+ "prefix": "da",
+ "description": "Debug.Assert",
+ "body": "Debug.Assert(${1:true});"
+ },
+ "cw": {
+ "prefix": "cw",
+ "description": "Console.WriteLine",
+ "body": "Console.WriteLine(\"$1\");"
+ },
+ "cr": {
+ "prefix": "cr",
+ "description": "Console.ReadLine",
+ "body": "Console.ReadLine();"
+ },
+ "mbox": {
+ "prefix": "mbox",
+ "description": "Message box",
+ "body": "MessageBox.Show(\"${1:message}\");"
+ },
+ "equals": {
+ "prefix": "equals",
+ "description": "Equality for a type",
+ "body": [
+ "public override bool Equals(object obj) => Equals(obj as ${1:TYPE});",
+ "",
+ "public bool Equals($1 other) // IEquatable<$1>",
+ "{",
+ "\tif (object.ReferenceEquals(other, null))",
+ "\t\treturn false;",
+ "\tif (object.ReferenceEquals(this, other))",
+ "\t\treturn true;",
+ "\tif (this.GetType() != other.GetType())",
+ "\t\treturn false;",
+ "\t$0",
+ "\treturn base.Equals(other);",
+ "\\}",
+ "",
+ "public override int GetHashCode() => base.GetHashCode();",
+ "",
+ "public static bool operator ==($1 x, $1 y) =>",
+ "\t(object.ReferenceEquals(x, null) && object.ReferenceEquals(y, null))",
+ "\t|| (!object.ReferenceEquals(x, null) && x.Equals(y));",
+ "",
+ "public static bool operator !=($1 x, $1 y) => !(x == y);",
+ ""
+ ]
+ },
+ "mth": {
+ "prefix": "mth",
+ "description": "Method",
+ "body": [
+ "${1:public} ${2:void} ${3:MyMethod}($4)",
+ "{",
+ "\t$0",
+ "\\}"
+ ]
+ },
+ "mths": {
+ "prefix": "mths",
+ "description": "Static method",
+ "body": [
+ "${1:public} static ${2:void} ${3:MyMethod}($4)",
+ "{",
+ "\t$0",
+ "\\}"
+ ]
+ },
+ "///": {
+ "prefix": "///",
+ "description": "XML summary comment",
+ "body": [
+ "/// <summary>",
+ "/// $0",
+ "/// </summary>"
+ ]
+ },
+ "<p": {
+ "prefix": "<p",
+ "description": "XML pramameter comment",
+ "body": "<param name=\"$1\">$2</param>"
+ },
+ "<ex": {
+ "prefix": "<ex",
+ "description": "XML exception comment",
+ "body": "<exception cref=\"${1:System.Exception}\">$2</exception>"
+ },
+ "<r": {
+ "prefix": "<r",
+ "description": "XML returns comment",
+ "body": "<returns>$0</returns>"
+ },
+ "<c": {
+ "prefix": "<c",
+ "description": "XML code comment",
+ "body": "<code>$0</code>"
+ }
+}