121 lines
2.2 KiB
JSON
121 lines
2.2 KiB
JSON
![]() |
{
|
||
|
// Place your snippets for cpp here. Each snippet is defined under a snippet name and has a prefix, body and
|
||
|
// description. 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": {
|
||
|
// "prefix": "log",
|
||
|
// "body": [
|
||
|
// "console.log('$1');",
|
||
|
// "$2"
|
||
|
// ],
|
||
|
// "description": "Log output to console"
|
||
|
// }
|
||
|
|
||
|
"Startup": {
|
||
|
"prefix": "rafay",
|
||
|
"body": [
|
||
|
"#include <iostream>",
|
||
|
"using namespace std;",
|
||
|
"",
|
||
|
"int main(){",
|
||
|
"",
|
||
|
"\t$0",
|
||
|
"",
|
||
|
"\treturn 0;",
|
||
|
"}"
|
||
|
]
|
||
|
},
|
||
|
"Better Cout": {
|
||
|
"prefix": "co",
|
||
|
"body": [
|
||
|
"cout<<$1;$0"
|
||
|
]
|
||
|
},
|
||
|
"fori": {
|
||
|
"prefix": ["fori"],
|
||
|
"body": [
|
||
|
"for(${1:int} ${2:i}=${3:0};${2:i}<${4:max};${2:i}${5:++}){",
|
||
|
"\t$0",
|
||
|
"}"
|
||
|
],
|
||
|
"description": "Indexed for loop"
|
||
|
},
|
||
|
"foreach": {
|
||
|
"prefix": ["foreach", "iter"],
|
||
|
"body": [
|
||
|
"for(${1:type} ${2:var} : ${3:iterable}){",
|
||
|
"\t$0",
|
||
|
"}"
|
||
|
],
|
||
|
"description": "Enhanced for loop"
|
||
|
},
|
||
|
"if": {
|
||
|
"prefix": ["if"],
|
||
|
"body": [
|
||
|
"if(${1:condition}){",
|
||
|
"\t$0",
|
||
|
"}"
|
||
|
],
|
||
|
"description": "if statement"
|
||
|
},
|
||
|
"ifelse": {
|
||
|
"prefix": ["ifelse"],
|
||
|
"body": [
|
||
|
"if(${1:condition}){",
|
||
|
"\t$2",
|
||
|
"}",
|
||
|
"else{",
|
||
|
"\t$0",
|
||
|
"}"
|
||
|
],
|
||
|
"description": "if/else statement"
|
||
|
},
|
||
|
"ifnull": {
|
||
|
"prefix": ["ifnull"],
|
||
|
"body": [
|
||
|
"if(${1:condition}==null){",
|
||
|
"\t$0",
|
||
|
"}"
|
||
|
],
|
||
|
"description": "if statement checking for null"
|
||
|
},
|
||
|
"ifnotnull": {
|
||
|
"prefix": ["ifnotnull"],
|
||
|
"body": [
|
||
|
"if(${1:condition}!=null){",
|
||
|
"\t$0",
|
||
|
"}"
|
||
|
],
|
||
|
"description": "if statement checking for not null"
|
||
|
},
|
||
|
"While Statement": {
|
||
|
"prefix": ["while"],
|
||
|
"body": [
|
||
|
"while(${1:condition}){",
|
||
|
"\t$0",
|
||
|
"}"
|
||
|
],
|
||
|
"description": "While Statement"
|
||
|
},
|
||
|
"Do-While Statement": {
|
||
|
"prefix": ["dowhile"],
|
||
|
"body": [
|
||
|
"do{",
|
||
|
"\t$0",
|
||
|
"}while(${1:condition});"
|
||
|
],
|
||
|
"description": "Do-While Statement"
|
||
|
},
|
||
|
"Switch Statement": {
|
||
|
"prefix": "switch",
|
||
|
"body": [
|
||
|
"switch(${1:key}){",
|
||
|
"\t$0",
|
||
|
"}"
|
||
|
],
|
||
|
"description": "Switch Statement"
|
||
|
},
|
||
|
|
||
|
}
|