Last active
February 14, 2017 19:29
-
-
Save callionica/818390f5ae31202cf2006bc09a445372 to your computer and use it in GitHub Desktop.
VSCode Snippets for C++ from Callionica --- Visual Studio Code - VS Code - VSCode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"include": { | |
"prefix": "#inc", | |
"body": [ | |
"#include \"$1\"", | |
"$0" | |
], | |
"description": "#include \"\"" | |
} | |
,"include-system": { | |
"prefix": "#inc<", | |
"body": [ | |
"#include <$1>", | |
"$0" | |
], | |
"description": "#include <>" | |
} | |
,"include-std": { | |
"prefix": "#incstd", | |
"body": [ | |
"#include <string>", | |
"#include <vector>", | |
"", | |
"using std::string;", | |
"using std::vector;", | |
"$0" | |
], | |
"description": "#include <string>\n#include <vector>" | |
} | |
,"struct": { | |
"prefix": "struct", | |
"body": [ | |
"struct ${1:name} {", | |
" $0", | |
"};" | |
], | |
"description": "struct" | |
} | |
,"class": { | |
"prefix": "class", | |
"body": [ | |
"class ${1:name} {", | |
" $0", | |
"};" | |
], | |
"description": "class" | |
} | |
,"namespace": { | |
"prefix": "namespace", | |
"body": [ | |
"namespace ${1:name} {", | |
" $0", | |
"};" | |
], | |
"description": "namespace" | |
} | |
,"template": { | |
"prefix": "template", | |
"body": [ | |
"template <class ${1:T}> ", | |
"$0" | |
], | |
"description": "template <class T>" | |
} | |
,"template1": { | |
"prefix": "template1", | |
"body": [ | |
"template <class ${1:T0}> ", | |
"$0" | |
], | |
"description": "template <class T0>" | |
} | |
,"template2": { | |
"prefix": "template2", | |
"body": [ | |
"template <class ${1:T0}, class ${2:T1}> ", | |
"$0" | |
], | |
"description": "template <class T0, class T1>" | |
} | |
,"template3": { | |
"prefix": "template3", | |
"body": [ | |
"template <class ${1:T0}, class ${2:T1}, class ${3:T2}> ", | |
"$0" | |
], | |
"description": "template <class T0, class T1, class T2>" | |
} | |
,"con5": { | |
"prefix": "con5", | |
"body": [ | |
"${1:name}() = ${2:default};", | |
"$1(const $1&) = ${3:default};", | |
"$1& operator=(const $1&) = $3;", | |
"$1($1&&) = ${4:default};", | |
"$1& operator=($1&&) = $4;", | |
"$0" | |
], | |
"description": "default, copy, and move constructors and operators" | |
} | |
,"explicit": { | |
"prefix": "explicit", | |
"body": [ | |
"explicit ${class:name}(${2:type} ${3:value}) : ${4:value_}($3) {", | |
"}", | |
"$0" | |
], | |
"description": "explicit constructor" | |
} | |
,"new": { | |
"prefix": "new", | |
"body": [ | |
"make_unique<${1:name}>(${3:value})$0" | |
], | |
"description": "make_unique<type>(value)" | |
} | |
,"new=": { | |
"prefix": "new=", | |
"body": [ | |
"auto ${1:result} = make_unique<${2:name}>(${3:value});", | |
"$0" | |
], | |
"description": "auto result = make_unique<type>(value);" | |
} | |
,"pragma": { | |
"prefix": "#pragma", | |
"body": [ | |
"#pragma ${1:once}", | |
"$0" | |
], | |
"description": "#pragma" | |
} | |
,"u8": { | |
"prefix": "u8", | |
"body": [ | |
"u8\"${TM_SELECTED_TEXT:}$1\"$0" | |
], | |
"description": "u8\"\"" | |
} | |
,"raw": { | |
"prefix": "raw", | |
"body": [ | |
"R\"!?!(${TM_SELECTED_TEXT:}$1)!?!\"$0" | |
], | |
"description": "R\"!?!()!?!\"" | |
} | |
,"return": { | |
"prefix": "return", | |
"body": [ | |
"return ${1:result};$0" | |
], | |
"description": "return result;" | |
} | |
,"static": { | |
"prefix": "static", | |
"body": [ | |
"static $0" | |
], | |
"description": "static" | |
} | |
,"inline": { | |
"prefix": "inline", | |
"body": [ | |
"inline $0" | |
], | |
"description": "inline" | |
} | |
,"const": { | |
"prefix": "const", | |
"body": [ | |
"const $0" | |
], | |
"description": "const" | |
} | |
,"auto": { | |
"prefix": "auto", | |
"body": [ | |
"auto $0" | |
], | |
"description": "auto" | |
} | |
,"auto=": { | |
"prefix": "auto=", | |
"body": [ | |
"auto ${1:result} = $0" | |
], | |
"description": "auto result =" | |
} | |
,"virtual": { | |
"prefix": "virtual", | |
"body": [ | |
"virtual $0" | |
], | |
"description": "virtual" | |
} | |
,"void": { | |
"prefix": "void", | |
"body": [ | |
"void $0" | |
], | |
"description": "void" | |
} | |
,"using": { | |
"prefix": "using", | |
"body": [ | |
"using $0" | |
], | |
"description": "using" | |
} | |
,"using=": { | |
"prefix": "using=", | |
"body": [ | |
"using ${1:new_name} = ${2:old_name};", | |
"$0" | |
], | |
"description": "using new_name = old_name;" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Experimenting with Visual Studio Code snippets for C++. Some of these wouldn't be necessary if the cpptools keyword completion added a space after the keyword.