aboutsummaryrefslogtreecommitdiff
path: root/snippets
diff options
context:
space:
mode:
Diffstat (limited to 'snippets')
-rw-r--r--snippets/c.json611
-rw-r--r--snippets/cpp.json766
2 files changed, 677 insertions, 700 deletions
diff --git a/snippets/c.json b/snippets/c.json
index 9a4eebe..4b7d6d7 100644
--- a/snippets/c.json
+++ b/snippets/c.json
@@ -1,319 +1,296 @@
{
- "Basic C main template": {
- "scope": "c",
- "prefix": "main",
- "body": [
- "#include <stdio.h>",
- "",
- "int main (int argc, char *argv[]) ",
- "{",
- " $0",
- " return 0;",
- "}"
- ],
- "description": "Basic main template in C"
- },
- "Basic C stdlib main template": {
- "scope": "c",
- "prefix": "libmain",
- "body": [
- "#include <stdio.h>",
- "#include <stdlib.h>",
- "",
- "int main (int argc, char *argv[]) ",
- "{",
- " $0",
- " return 0;",
- "}"
- ],
- "description": "Basic stdlib main templace in C"
- },
- "If statement": {
- "scope": "c",
- "prefix": "if",
- "body": [
- "if ($1) {",
- " ${2:/* code here */} ",
- "}"
- ],
- "description": "Creates an if statement"
- },
- "Else statement": {
- "scope": "c",
- "prefix": "else",
- "body": [
- "else {",
- " ${0:/* code here */}",
- "}"
- ],
- "description": "Creates an else statement"
- },
- "Else if statement": {
- "scope": "c",
- "prefix": "elif",
- "body": [
- "else if ($1) {",
- " ${2:/* code here */}",
- "}"
- ],
- "description": "Creates an else if statement"
- },
- "Switch": {
- "scope": "c",
- "prefix": "switch",
- "body": [
- "switch ($1) ",
- "{",
- " case $2:",
- " $3;",
- " break;",
- "",
- " default:",
- " $4;",
- " break;",
- "}"
- ],
- "description": "Creates a void function"
- },
- "For loop": {
- "scope": "c",
- "prefix": "for",
- "body": [
- "for (int ${1:i} = ${2:0}; ${1:i} < $3; ++${1:i}) {",
- " ${4:/* code goes here */}",
- "}"
- ],
- "description": "Creates a for loop"
- },
- "Reverse For loop": {
- "scope": "c",
- "prefix": "forrev",
- "body": [
- "for (int ${1:i} = $2; ${1:i} >= ${3:0}; --${1:i}) {",
- " ${4:/* code goes here */}",
- "}"
- ],
- "description": "Creates a reverse for loop"
- },
- "Range For loop": {
- "scope": "cpp",
- "prefix": "forrange",
- "body": [
- "for (auto &${1:element} : ${2:containeur}) {",
- " ${3:/* code goes here */}",
- "}"
- ],
- "description": "Creates a range for loop"
- },
- "While loop": {
- "scope": "c",
- "prefix": "while",
- "body": [
- "while ($1) {",
- " ${2:/* code goes here */}",
- "}"
- ],
- "description": "Creates a while loop"
- },
- "Do...while loop": {
- "scope": "c",
- "prefix": "dowhile",
- "body": [
- "do {",
- " ${1:/* code goes here */}",
- "} while($2)"
- ],
- "description": "Creates a do...while loop"
- },
- "Create linked list": {
- "scope": "c",
- "prefix": "clist",
- "body": [
- "typedef struct {",
- " ${1:int} value;",
- " struct node_t* next;",
- "} node_t;"
- ],
- "description": "Creates a linked list template"
- },
- "Create int function": {
- "scope": "c",
- "prefix": "intf",
- "body": [
- "int $1 (${2:void})",
- "{",
- " $4",
- " return $3;",
- "}"
- ],
- "description": "Creates a function that returns an int"
- },
- "Create float function": {
- "scope": "c",
- "prefix": "floatf",
- "body": [
- "float $1 (${2:void}) ",
- "{",
- " $4",
- " return $3;",
- "}"
- ],
- "description": "Creates a function that returns a float"
- },
- "Create double function": {
- "scope": "c",
- "prefix": "doublef",
- "body": [
- "double $1 (${2:void})",
- "{",
- " $4",
- " return $3;",
- "}"
- ],
- "description": "Creates a function that returns a double"
- },
- "Create string function": {
- "scope": "c",
- "prefix": "strf",
- "body": [
- "char* $1 (${2:void})",
- "{",
- " $4",
- " return $3;",
- "}"
- ],
- "description": "Creates a function that returns a string"
- },
- "Create long function": {
- "scope": "c",
- "prefix": "longf",
- "body": [
- "long $1 (${2:void}) ",
- "{",
- " $4",
- " return $3;",
- "}"
- ],
- "description": "Creates a function that returns a long"
- },
- "Create short function": {
- "scope": "c",
- "prefix": "shortf",
- "body": [
- "short $1 (${2:void}) ",
- "{",
- " $4",
- " return $3;",
- "}"
- ],
- "description": "Creates a function that returns a short"
- },
- "Create void function": {
- "scope": "c",
- "prefix": "voidf",
- "body": [
- "void $1 (${2:void}) ",
- "{",
- " $3",
- "}"
- ],
- "description": "Creates a void function"
- },
- "Creates a header include guard C": {
- "scope": "c",
- "prefix": "ig",
- "body": [
- "#ifndef ${TM_FILENAME/(.*)\\..+$/${1:/upcase}_H/}",
- "#define ${TM_FILENAME/(.*)\\..+$/${1:/upcase}_H/}",
- "",
- "${0:// Code for header body}",
- "",
- "#endif // ${TM_FILENAME/(.*)\\..+$/${1:/upcase}_H/}"
- ],
- "description": "Creates header include guard based on file name for C projets"
- },
- "Creates a header include guard C++": {
- "scope": "cpp",
- "prefix": "ig",
- "body": [
- "#ifndef ${TM_FILENAME/(.*)\\..+$/${1:/upcase}_HPP/}",
- "#define ${TM_FILENAME/(.*)\\..+$/${1:/upcase}_HPP/}",
- "",
- "${0:// Code for header body}",
- "",
- "#endif // ${TM_FILENAME/(.*)\\..+$/${1:/upcase}_HPP/}"
- ],
- "description": "Creates header include guard based on file name for C++ projects"
- },
- "Include": {
- "scope": "c",
- "prefix": "inc",
- "body": [
- "#include <$0>"
- ],
- "description": "Include a header into a file"
- },
- "Malloc": {
- "scope": "c",
- "prefix": "malloc",
- "body": [
- "malloc($1 * sizeof(${2:int}))"
- ],
- "description": "Arrow for pointers in C & C++"
- },
- "fopen": {
- "scope": "c",
- "prefix": "fopen",
- "body": [
- "fopen(\"${1:monfichier}\", \"${2|r,r+,w,w+,a,a+|}\")"
- ],
- "description": "Open a file"
- },
- "define": {
- "scope": "c",
- "prefix": "define",
- "body": [
- "#define $1 $2"
- ],
- "description": "Define a constant"
- },
- "enum": {
- "scope": "c",
- "prefix": "enum",
- "body": [
- "enum $1 {$2, $3}"
- ],
- "description": "Arrow for pointers in C & C++"
- },
- "union": {
- "scope": "c",
- "prefix": "union",
- "body": [
- "union $1 {",
- " $2;",
- " $3;",
- "}"
- ],
- "description": "Arrow for pointers in C & C++"
- },
- "struct": {
- "scope": "c",
- "prefix": "struct",
- "body": [
- "struct $1 {",
- "${2:// Code goes here}",
- "};"
- ],
- "description": "Struct in C & C++"
- },
- "typedef": {
- "scope": "c",
- "prefix": "type",
- "body": [
- "typedef struct _$1 {",
- "${2:// Code goes here}",
- "} t_$1;"
- ],
- "description": "Typedef struct in C & C++"
- }
+ "Basic C main template": {
+ "scope": "c",
+ "prefix": "main",
+ "body": [
+ "#include <stdio.h>",
+ "",
+ "int main (int argc, char *argv[]) ",
+ "{",
+ " $0",
+ " return 0;",
+ "}"
+ ],
+ "description": "Basic main template in C"
+ },
+ "Basic C stdlib main template": {
+ "scope": "c",
+ "prefix": "libmain",
+ "body": [
+ "#include <stdio.h>",
+ "#include <stdlib.h>",
+ "",
+ "int main (int argc, char *argv[]) ",
+ "{",
+ " $0",
+ " return 0;",
+ "}"
+ ],
+ "description": "Basic stdlib main templace in C"
+ },
+ "If statement": {
+ "scope": "c",
+ "prefix": "if",
+ "body": [
+ "if ($1) {",
+ " ${2:/* code here */} ",
+ "}"
+ ],
+ "description": "Creates an if statement"
+ },
+ "Else statement": {
+ "scope": "c",
+ "prefix": "else",
+ "body": [
+ "else {",
+ " ${0:/* code here */}",
+ "}"
+ ],
+ "description": "Creates an else statement"
+ },
+ "Else if statement": {
+ "scope": "c",
+ "prefix": "elif",
+ "body": [
+ "else if ($1) {",
+ " ${2:/* code here */}",
+ "}"
+ ],
+ "description": "Creates an else if statement"
+ },
+ "Switch": {
+ "scope": "c",
+ "prefix": "switch",
+ "body": [
+ "switch ($1) ",
+ "{",
+ " case $2:",
+ " $3;",
+ " break;",
+ "",
+ " default:",
+ " $4;",
+ " break;",
+ "}"
+ ],
+ "description": "Creates a void function"
+ },
+ "For loop": {
+ "scope": "c",
+ "prefix": "for",
+ "body": [
+ "for (int ${1:i} = ${2:0}; ${1:i} < $3; ++${1:i}) {",
+ " ${4:/* code goes here */}",
+ "}"
+ ],
+ "description": "Creates a for loop"
+ },
+ "Reverse For loop": {
+ "scope": "c",
+ "prefix": "forrev",
+ "body": [
+ "for (int ${1:i} = $2; ${1:i} >= ${3:0}; --${1:i}) {",
+ " ${4:/* code goes here */}",
+ "}"
+ ],
+ "description": "Creates a reverse for loop"
+ },
+ "While loop": {
+ "scope": "c",
+ "prefix": "while",
+ "body": [
+ "while ($1) {",
+ " ${2:/* code goes here */}",
+ "}"
+ ],
+ "description": "Creates a while loop"
+ },
+ "Do...while loop": {
+ "scope": "c",
+ "prefix": "dowhile",
+ "body": [
+ "do {",
+ " ${1:/* code goes here */}",
+ "} while($2)"
+ ],
+ "description": "Creates a do...while loop"
+ },
+ "Create linked list": {
+ "scope": "c",
+ "prefix": "clist",
+ "body": [
+ "typedef struct {",
+ " ${1:int} value;",
+ " struct node_t* next;",
+ "} node_t;"
+ ],
+ "description": "Creates a linked list template"
+ },
+ "Create int function": {
+ "scope": "c",
+ "prefix": "intf",
+ "body": [
+ "int $1 (${2:void})",
+ "{",
+ " $4",
+ " return $3;",
+ "}"
+ ],
+ "description": "Creates a function that returns an int"
+ },
+ "Create float function": {
+ "scope": "c",
+ "prefix": "floatf",
+ "body": [
+ "float $1 (${2:void}) ",
+ "{",
+ " $4",
+ " return $3;",
+ "}"
+ ],
+ "description": "Creates a function that returns a float"
+ },
+ "Create double function": {
+ "scope": "c",
+ "prefix": "doublef",
+ "body": [
+ "double $1 (${2:void})",
+ "{",
+ " $4",
+ " return $3;",
+ "}"
+ ],
+ "description": "Creates a function that returns a double"
+ },
+ "Create string function": {
+ "scope": "c",
+ "prefix": "strf",
+ "body": [
+ "char* $1 (${2:void})",
+ "{",
+ " $4",
+ " return $3;",
+ "}"
+ ],
+ "description": "Creates a function that returns a string"
+ },
+ "Create long function": {
+ "scope": "c",
+ "prefix": "longf",
+ "body": [
+ "long $1 (${2:void}) ",
+ "{",
+ " $4",
+ " return $3;",
+ "}"
+ ],
+ "description": "Creates a function that returns a long"
+ },
+ "Create short function": {
+ "scope": "c",
+ "prefix": "shortf",
+ "body": [
+ "short $1 (${2:void}) ",
+ "{",
+ " $4",
+ " return $3;",
+ "}"
+ ],
+ "description": "Creates a function that returns a short"
+ },
+ "Create void function": {
+ "scope": "c",
+ "prefix": "voidf",
+ "body": [
+ "void $1 (${2:void}) ",
+ "{",
+ " $3",
+ "}"
+ ],
+ "description": "Creates a void function"
+ },
+ "Creates a header include guard C": {
+ "scope": "c",
+ "prefix": "ig",
+ "body": [
+ "#ifndef ${TM_FILENAME/(.*)\\..+$/${1:/upcase}_H/}",
+ "#define ${TM_FILENAME/(.*)\\..+$/${1:/upcase}_H/}",
+ "",
+ "${0:// Code for header body}",
+ "",
+ "#endif // ${TM_FILENAME/(.*)\\..+$/${1:/upcase}_H/}"
+ ],
+ "description": "Creates header include guard based on file name for C projets"
+ },
+ "Include": {
+ "scope": "c",
+ "prefix": "inc",
+ "body": [
+ "#include <$0>"
+ ],
+ "description": "Include a header into a file"
+ },
+ "Malloc": {
+ "scope": "c",
+ "prefix": "malloc",
+ "body": [
+ "malloc($1 * sizeof(${2:int}))"
+ ],
+ "description": "Arrow for pointers in C & C++"
+ },
+ "fopen": {
+ "scope": "c",
+ "prefix": "fopen",
+ "body": [
+ "fopen(\"${1:monfichier}\", \"${2|r,r+,w,w+,a,a+|}\")"
+ ],
+ "description": "Open a file"
+ },
+ "define": {
+ "scope": "c",
+ "prefix": "define",
+ "body": [
+ "#define $1 $2"
+ ],
+ "description": "Define a constant"
+ },
+ "enum": {
+ "scope": "c",
+ "prefix": "enum",
+ "body": [
+ "enum $1 {$2, $3}"
+ ],
+ "description": "Arrow for pointers in C & C++"
+ },
+ "union": {
+ "scope": "c",
+ "prefix": "union",
+ "body": [
+ "union $1 {",
+ " $2;",
+ " $3;",
+ "}"
+ ],
+ "description": "Arrow for pointers in C & C++"
+ },
+ "struct": {
+ "scope": "c",
+ "prefix": "struct",
+ "body": [
+ "struct $1 {",
+ "${2:// Code goes here}",
+ "};"
+ ],
+ "description": "Struct in C & C++"
+ },
+ "typedef": {
+ "scope": "c",
+ "prefix": "type",
+ "body": [
+ "typedef struct _$1 {",
+ "${2:// Code goes here}",
+ "} t_$1;"
+ ],
+ "description": "Typedef struct in C & C++"
+ }
}
diff --git a/snippets/cpp.json b/snippets/cpp.json
index aca55d0..cccef34 100644
--- a/snippets/cpp.json
+++ b/snippets/cpp.json
@@ -1,385 +1,385 @@
{
- "Basic C++ main template": {
- "scope": "cpp",
- "prefix": "main",
- "body": [
- "#include <cstdio>",
- "",
- "int main (int argc, char *argv[]) ",
- "{",
- " $0",
- " return 0;",
- "}"
- ],
- "description": "Basic main template in C++"
- },
- "Basic C++ iostream main template": {
- "scope": "cpp",
- "prefix": "iomain",
- "body": [
- "#include <cstdio>",
- "#include <iostream>",
- "",
- "int main (int argc, char *argv[])",
- "{",
- " $0",
- " return 0;",
- "}"
- ],
- "description": "Basic iostream main templace in C++"
- },
- "If statement": {
- "scope": "c",
- "prefix": "if",
- "body": [
- "if ($1) {",
- " ${2:/* code here */} ",
- "}"
- ],
- "description": "Creates an if statement"
- },
- "Else statement": {
- "scope": "c",
- "prefix": "else",
- "body": [
- "else {",
- " ${0:/* code here */}",
- "}"
- ],
- "description": "Creates an else statement"
- },
- "Else if statement": {
- "scope": "c",
- "prefix": "elif",
- "body": [
- "else if ($1) {",
- " ${2:/* code here */}",
- "}"
- ],
- "description": "Creates an else if statement"
- },
- "Switch": {
- "scope": "c",
- "prefix": "switch",
- "body": [
- "switch ($1) ",
- "{",
- " case $2:",
- " $3;",
- " break;",
- "",
- " default:",
- " $4;",
- " break;",
- "}"
- ],
- "description": "Creates a void function"
- },
- "For loop": {
- "scope": "c",
- "prefix": "for",
- "body": [
- "for (int ${1:i} = ${2:0}; ${1:i} < $3; ++${1:i}) {",
- " ${4:/* code goes here */}",
- "}"
- ],
- "description": "Creates a for loop"
- },
- "Reverse For loop": {
- "scope": "c",
- "prefix": "forrev",
- "body": [
- "for (int ${1:i} = $2; ${1:i} >= ${3:0}; --${1:i}) {",
- " ${4:/* code goes here */}",
- "}"
- ],
- "description": "Creates a reverse for loop"
- },
- "Range For loop": {
- "scope": "cpp",
- "prefix": "forrange",
- "body": [
- "for (auto &${1:element} : ${2:containeur}) {",
- " ${3:/* code goes here */}",
- "}"
- ],
- "description": "Creates a range for loop"
- },
- "While loop": {
- "scope": "c",
- "prefix": "while",
- "body": [
- "while ($1) {",
- " ${2:/* code goes here */}",
- "}"
- ],
- "description": "Creates a while loop"
- },
- "Do...while loop": {
- "scope": "c",
- "prefix": "dowhile",
- "body": [
- "do {",
- " ${1:/* code goes here */}",
- "} while($2)"
- ],
- "description": "Creates a do...while loop"
- },
- "Create linked list": {
- "scope": "c",
- "prefix": "clist",
- "body": [
- "typedef struct {",
- " ${1:int} value;",
- " struct node_t* next;",
- "} node_t;"
- ],
- "description": "Creates a linked list template"
- },
- "Create int function": {
- "scope": "c",
- "prefix": "intf",
- "body": [
- "int $1 (${2:void})",
- "{",
- " $4",
- " return $3;",
- "}"
- ],
- "description": "Creates a function that returns an int"
- },
- "Create float function": {
- "scope": "c",
- "prefix": "floatf",
- "body": [
- "float $1 (${2:void}) ",
- "{",
- " $4",
- " return $3;",
- "}"
- ],
- "description": "Creates a function that returns a float"
- },
- "Create double function": {
- "scope": "c",
- "prefix": "doublef",
- "body": [
- "double $1 (${2:void})",
- "{",
- " $4",
- " return $3;",
- "}"
- ],
- "description": "Creates a function that returns a double"
- },
- "Create string function": {
- "scope": "c",
- "prefix": "strf",
- "body": [
- "char* $1 (${2:void})",
- "{",
- " $4",
- " return $3;",
- "}"
- ],
- "description": "Creates a function that returns a string"
- },
- "Create long function": {
- "scope": "c",
- "prefix": "longf",
- "body": [
- "long $1 (${2:void}) ",
- "{",
- " $4",
- " return $3;",
- "}"
- ],
- "description": "Creates a function that returns a long"
- },
- "Create short function": {
- "scope": "c",
- "prefix": "shortf",
- "body": [
- "short $1 (${2:void}) ",
- "{",
- " $4",
- " return $3;",
- "}"
- ],
- "description": "Creates a function that returns a short"
- },
- "Create void function": {
- "scope": "c",
- "prefix": "voidf",
- "body": [
- "void $1 (${2:void}) ",
- "{",
- " $3",
- "}"
- ],
- "description": "Creates a void function"
- },
- "Creates a header include guard C++": {
- "scope": "cpp",
- "prefix": "ig",
- "body": [
- "#ifndef ${TM_FILENAME/(.*)\\..+$/${1:/upcase}_HPP/}",
- "#define ${TM_FILENAME/(.*)\\..+$/${1:/upcase}_HPP/}",
- "",
- "${0:// Code for header body}",
- "",
- "#endif // ${TM_FILENAME/(.*)\\..+$/${1:/upcase}_HPP/}"
- ],
- "description": "Creates header include guard based on file name for C++ projects"
- },
- "Include": {
- "scope": "c",
- "prefix": "inc",
- "body": [
- "#include <$0>"
- ],
- "description": "Include a header into a file"
- },
- "Malloc": {
- "scope": "c",
- "prefix": "malloc",
- "body": [
- "malloc($1 * sizeof(${2:int}))"
- ],
- "description": "Arrow for pointers in C & C++"
- },
- "fopen": {
- "scope": "c",
- "prefix": "fopen",
- "body": [
- "fopen(\"${1:monfichier}\", \"${2|r,r+,w,w+,a,a+|}\")"
- ],
- "description": "Open a file"
- },
- "define": {
- "scope": "c",
- "prefix": "define",
- "body": [
- "#define $1 $2"
- ],
- "description": "Define a constant"
- },
- "enum": {
- "scope": "c",
- "prefix": "enum",
- "body": [
- "enum $1 {$2, $3}"
- ],
- "description": "Arrow for pointers in C & C++"
- },
- "union": {
- "scope": "c",
- "prefix": "union",
- "body": [
- "union $1 {",
- " $2;",
- " $3;",
- "}"
- ],
- "description": "Arrow for pointers in C & C++"
- },
- "struct": {
- "scope": "c",
- "prefix": "struct",
- "body": [
- "struct $1 {",
- "${2:// Code goes here}",
- "};"
- ],
- "description": "Struct in C & C++"
- },
- "typedef": {
- "scope": "c",
- "prefix": "type",
- "body": [
- "typedef struct _$1 {",
- "${2:// Code goes here}",
- "} t_$1;"
- ],
- "description": "Typedef struct in C & C++"
- },
- "vector": {
- "scope": "cpp",
- "prefix": "vector",
- "body": [
- "std::vector<$1> $2;"
- ],
- "description": "std::vector in C++"
- },
- "array": {
- "scope": "cpp",
- "prefix": "array",
- "body": [
- "std::array<$1,$2> $3;"
- ],
- "description": "std::array in C++"
- },
- "fichier": {
- "scope": "cpp",
- "prefix": "file",
- "body": [
- "std::${1|ofstream,ifstream|} $2 {${3:'monfichier.txt'}${4:, std::ios::app}};"
- ],
- "description": "Files in C++"
- },
- "lambda": {
- "scope": "cpp",
- "prefix": "lambda",
- "body": [
- "[${1:// Capture zone}](${2:// Parameters}) -> ${3:// Return type} {${4:// Your code goes here}};"
- ],
- "description": "Lambda in C++"
- },
- "template": {
- "scope": "cpp",
- "prefix": "template",
- "body": [
- "template <${1:typename T}>",
- "${2:void} $3($4) {",
- "${5:// Code goes here}",
- "}"
- ],
- "description": "Template in C++"
- },
- "class": {
- "scope": "cpp",
- "prefix": "class",
- "body": [
- "class $1",
- "{",
- " public:",
- " $2",
- " private:",
- " $3",
- "};"
- ],
- "description": "Class in C++"
- },
- "set": {
- "scope": "cpp",
- "prefix": "set",
- "body": [
- "$1 set_$2 ($3 $4)",
- "{",
- " this->$2 = $4;",
- "}"
- ],
- "description": "Setteur in C++"
- },
- "get": {
- "scope": "cpp",
- "prefix": "get",
- "body": [
- "$1 get_$2 ()",
- "{",
- " return this->$2;",
- "}"
- ],
- "description": "Getteur in C++"
- }
+ "Basic C++ main template": {
+ "scope": "cpp",
+ "prefix": "main",
+ "body": [
+ "#include <cstdio>",
+ "",
+ "int main (int argc, char *argv[]) ",
+ "{",
+ " $0",
+ " return 0;",
+ "}"
+ ],
+ "description": "Basic main template in C++"
+ },
+ "Basic C++ iostream main template": {
+ "scope": "cpp",
+ "prefix": "iomain",
+ "body": [
+ "#include <cstdio>",
+ "#include <iostream>",
+ "",
+ "int main (int argc, char *argv[])",
+ "{",
+ " $0",
+ " return 0;",
+ "}"
+ ],
+ "description": "Basic iostream main templace in C++"
+ },
+ "If statement": {
+ "scope": "cpp",
+ "prefix": "if",
+ "body": [
+ "if ($1) {",
+ " ${2:/* code here */} ",
+ "}"
+ ],
+ "description": "Creates an if statement"
+ },
+ "Else statement": {
+ "scope": "cpp",
+ "prefix": "else",
+ "body": [
+ "else {",
+ " ${0:/* code here */}",
+ "}"
+ ],
+ "description": "Creates an else statement"
+ },
+ "Else if statement": {
+ "scope": "cpp",
+ "prefix": "elif",
+ "body": [
+ "else if ($1) {",
+ " ${2:/* code here */}",
+ "}"
+ ],
+ "description": "Creates an else if statement"
+ },
+ "Switch": {
+ "scope": "cpp",
+ "prefix": "switch",
+ "body": [
+ "switch ($1) ",
+ "{",
+ " case $2:",
+ " $3;",
+ " break;",
+ "",
+ " default:",
+ " $4;",
+ " break;",
+ "}"
+ ],
+ "description": "Creates a void function"
+ },
+ "For loop": {
+ "scope": "cpp",
+ "prefix": "for",
+ "body": [
+ "for (int ${1:i} = ${2:0}; ${1:i} < $3; ++${1:i}) {",
+ " ${4:/* code goes here */}",
+ "}"
+ ],
+ "description": "Creates a for loop"
+ },
+ "Reverse For loop": {
+ "scope": "cpp",
+ "prefix": "forrev",
+ "body": [
+ "for (int ${1:i} = $2; ${1:i} >= ${3:0}; --${1:i}) {",
+ " ${4:/* code goes here */}",
+ "}"
+ ],
+ "description": "Creates a reverse for loop"
+ },
+ "Range For loop": {
+ "scope": "cpp",
+ "prefix": "forrange",
+ "body": [
+ "for (auto &${1:element} : ${2:containeur}) {",
+ " ${3:/* code goes here */}",
+ "}"
+ ],
+ "description": "Creates a range for loop"
+ },
+ "While loop": {
+ "scope": "cpp",
+ "prefix": "while",
+ "body": [
+ "while ($1) {",
+ " ${2:/* code goes here */}",
+ "}"
+ ],
+ "description": "Creates a while loop"
+ },
+ "Do...while loop": {
+ "scope": "cpp",
+ "prefix": "dowhile",
+ "body": [
+ "do {",
+ " ${1:/* code goes here */}",
+ "} while($2)"
+ ],
+ "description": "Creates a do...while loop"
+ },
+ "Create linked list": {
+ "scope": "cpp",
+ "prefix": "clist",
+ "body": [
+ "typedef struct {",
+ " ${1:int} value;",
+ " struct node_t* next;",
+ "} node_t;"
+ ],
+ "description": "Creates a linked list template"
+ },
+ "Create int function": {
+ "scope": "cpp",
+ "prefix": "intf",
+ "body": [
+ "int $1 (${2:void})",
+ "{",
+ " $4",
+ " return $3;",
+ "}"
+ ],
+ "description": "Creates a function that returns an int"
+ },
+ "Create float function": {
+ "scope": "cpp",
+ "prefix": "floatf",
+ "body": [
+ "float $1 (${2:void}) ",
+ "{",
+ " $4",
+ " return $3;",
+ "}"
+ ],
+ "description": "Creates a function that returns a float"
+ },
+ "Create double function": {
+ "scope": "cpp",
+ "prefix": "doublef",
+ "body": [
+ "double $1 (${2:void})",
+ "{",
+ " $4",
+ " return $3;",
+ "}"
+ ],
+ "description": "Creates a function that returns a double"
+ },
+ "Create string function": {
+ "scope": "cpp",
+ "prefix": "strf",
+ "body": [
+ "char* $1 (${2:void})",
+ "{",
+ " $4",
+ " return $3;",
+ "}"
+ ],
+ "description": "Creates a function that returns a string"
+ },
+ "Create long function": {
+ "scope": "cpp",
+ "prefix": "longf",
+ "body": [
+ "long $1 (${2:void}) ",
+ "{",
+ " $4",
+ " return $3;",
+ "}"
+ ],
+ "description": "Creates a function that returns a long"
+ },
+ "Create short function": {
+ "scope": "cpp",
+ "prefix": "shortf",
+ "body": [
+ "short $1 (${2:void}) ",
+ "{",
+ " $4",
+ " return $3;",
+ "}"
+ ],
+ "description": "Creates a function that returns a short"
+ },
+ "Create void function": {
+ "scope": "cpp",
+ "prefix": "voidf",
+ "body": [
+ "void $1 (${2:void}) ",
+ "{",
+ " $3",
+ "}"
+ ],
+ "description": "Creates a void function"
+ },
+ "Creates a header include guard C++": {
+ "scope": "cpp",
+ "prefix": "ig",
+ "body": [
+ "#ifndef ${TM_FILENAME/(.*)\\..+$/${1:/upcase}_HPP/}",
+ "#define ${TM_FILENAME/(.*)\\..+$/${1:/upcase}_HPP/}",
+ "",
+ "${0:// Code for header body}",
+ "",
+ "#endif // ${TM_FILENAME/(.*)\\..+$/${1:/upcase}_HPP/}"
+ ],
+ "description": "Creates header include guard based on file name for C++ projects"
+ },
+ "Include": {
+ "scope": "c",
+ "prefix": "inc",
+ "body": [
+ "#include <$0>"
+ ],
+ "description": "Include a header into a file"
+ },
+ "Malloc": {
+ "scope": "cpp",
+ "prefix": "malloc",
+ "body": [
+ "malloc($1 * sizeof(${2:int}))"
+ ],
+ "description": "Arrow for pointers in C & C++"
+ },
+ "fopen": {
+ "scope": "c",
+ "prefix": "fopen",
+ "body": [
+ "fopen(\"${1:monfichier}\", \"${2|r,r+,w,w+,a,a+|}\")"
+ ],
+ "description": "Open a file"
+ },
+ "define": {
+ "scope": "cpp",
+ "prefix": "define",
+ "body": [
+ "#define $1 $2"
+ ],
+ "description": "Define a constant"
+ },
+ "enum": {
+ "scope": "cpp",
+ "prefix": "enum",
+ "body": [
+ "enum $1 {$2, $3}"
+ ],
+ "description": "Arrow for pointers in C & C++"
+ },
+ "union": {
+ "scope": "cpp",
+ "prefix": "union",
+ "body": [
+ "union $1 {",
+ " $2;",
+ " $3;",
+ "}"
+ ],
+ "description": "Arrow for pointers in C & C++"
+ },
+ "struct": {
+ "scope": "cpp",
+ "prefix": "struct",
+ "body": [
+ "struct $1 {",
+ "${2:// Code goes here}",
+ "};"
+ ],
+ "description": "Struct in C & C++"
+ },
+ "typedef": {
+ "scope": "cpp",
+ "prefix": "type",
+ "body": [
+ "typedef struct _$1 {",
+ "${2:// Code goes here}",
+ "} t_$1;"
+ ],
+ "description": "Typedef struct in C & C++"
+ },
+ "vector": {
+ "scope": "cpp",
+ "prefix": "vector",
+ "body": [
+ "std::vector<$1> $2;"
+ ],
+ "description": "std::vector in C++"
+ },
+ "array": {
+ "scope": "cpp",
+ "prefix": "array",
+ "body": [
+ "std::array<$1,$2> $3;"
+ ],
+ "description": "std::array in C++"
+ },
+ "fichier": {
+ "scope": "cpp",
+ "prefix": "file",
+ "body": [
+ "std::${1|ofstream,ifstream|} $2 {${3:'monfichier.txt'}${4:, std::ios::app}};"
+ ],
+ "description": "Files in C++"
+ },
+ "lambda": {
+ "scope": "cpp",
+ "prefix": "lambda",
+ "body": [
+ "[${1:// Capture zone}](${2:// Parameters}) -> ${3:// Return type} {${4:// Your code goes here}};"
+ ],
+ "description": "Lambda in C++"
+ },
+ "template": {
+ "scope": "cpp",
+ "prefix": "template",
+ "body": [
+ "template <${1:typename T}>",
+ "${2:void} $3($4) {",
+ "${5:// Code goes here}",
+ "}"
+ ],
+ "description": "Template in C++"
+ },
+ "class": {
+ "scope": "cpp",
+ "prefix": "class",
+ "body": [
+ "class $1",
+ "{",
+ " public:",
+ " $2",
+ " private:",
+ " $3",
+ "};"
+ ],
+ "description": "Class in C++"
+ },
+ "set": {
+ "scope": "cpp",
+ "prefix": "set",
+ "body": [
+ "$1 set_$2 ($3 $4)",
+ "{",
+ " this->$2 = $4;",
+ "}"
+ ],
+ "description": "Setteur in C++"
+ },
+ "get": {
+ "scope": "cpp",
+ "prefix": "get",
+ "body": [
+ "$1 get_$2 ()",
+ "{",
+ " return this->$2;",
+ "}"
+ ],
+ "description": "Getteur in C++"
+ }
}
ArKa projects. All rights to me, and your next child right arm.