Skip to content

Commit

Permalink
improve some snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
kkonghao committed Nov 27, 2019
1 parent 93070f9 commit 2692a51
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 31 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ This extension for Visual Studio Code adds snippets for C/C++.
2. Launch VS Code
3. From the command palette `Ctrl`+`Shift`+`P` (Windows, Linux) or `Cmd`+`Shift`+`P` (OSX)
4. Type `ext install` or just simply select `Install Extension`
5. Choose the extension - Cpp Snippets
6. Relaunch VS Code
5. Choose the extension - C/C++ Dog Snippets



*Suggestions for improvement are welcome.*
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"publisher": "kkonghao",
"displayName": "C/C++ Dog Snippets",
"description": "Code snippets for C/C++",
"version": "0.1.21",
"version": "0.1.25",
"engines": {
"vscode": "^0.10.1"
},
Expand Down
11 changes: 5 additions & 6 deletions snippets/c.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@
"#ifndef": {
"prefix": "#ifndef",
"body": [
"#ifndef __${TM_FILENAME_BASE}_h__",
"#define __${TM_FILENAME_BASE}_h__",
"#ifndef __${TM_FILENAME_BASE}__h__",
"#define __${TM_FILENAME_BASE}__h__",
"$0",
"#endif //!__${TM_FILENAME_BASE}_h__"
"#endif //!__${TM_FILENAME_BASE}__h__"
],
"description": "Code snippet for #ifndef"
},
Expand Down Expand Up @@ -180,10 +180,9 @@
"/**",
"**********************************************************************************************************************************************************************************************************************************",
"* @file:\t$TM_FILENAME",
"* @author:\t$2",
"* @version:\t$3",
"* @author:\t$1",
"* @date:\t$CURRENT_YEAR年$CURRENT_MONTH月$CURRENT_DATE日 $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND $CURRENT_DAY_NAME",
"* @brief:\t$5",
"* @brief:\t$2",
"**********************************************************************************************************************************************************************************************************************************",
"**/"
],
Expand Down
50 changes: 28 additions & 22 deletions snippets/cpp.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"description": ""
},


"for": {
"prefix": "for",
"body": [
Expand All @@ -23,7 +23,7 @@
"foreach":{
"prefix":"fore",
"body":[
"for (auto &i : $1)",
"for (auto &$1 : $2)",
"{",
"\t$0",
"}\n"
Expand Down Expand Up @@ -119,10 +119,10 @@
"#ifndef": {
"prefix": "#ifndef",
"body": [
"#ifndef __${TM_FILENAME_BASE:/upcase}_h__",
"#define __${TM_FILENAME_BASE}_h__",
"#ifndef __${TM_FILENAME_BASE}__h__",
"#define __${TM_FILENAME_BASE}__h__",
"$0",
"#endif //!__${TM_FILENAME_BASE}_h__"
"#endif //!__${TM_FILENAME_BASE}__h__"
],
"description": "Code snippet for #ifndef"
},
Expand All @@ -143,7 +143,7 @@
"struct $1",
"{",
"\t$0",
"};"
"};\n"
],
"description": "Code snippet for struct"
},
Expand Down Expand Up @@ -203,19 +203,19 @@
"prefix":"cin",
"body":
[
"std::cin << "
"std::cin << $0"
],
"description": "Code snippet for printing to std::cout"
"description": "Code snippet for std::cout"
},

"cout":
{
"prefix": "cout",
"body":
[
"std::cout << "
"std::cout << $0"
],
"description": "Code snippet for printing to std::coutt"
"description": "Code snippet for std::coutt"
},

"endl":
Expand All @@ -236,7 +236,7 @@
},

"main": {
"prefix": [ "main" ],
"prefix": "main",
"body": [
"int\tmain(int argc, char **argv)",
"{",
Expand All @@ -256,10 +256,9 @@
"/**",
"**********************************************************************************************************************************************************************************************************************************",
"* @file:\t$TM_FILENAME",
"* @author:\t$2",
"* @version:\t$3",
"* @author:\t$1",
"* @date:\t$CURRENT_YEAR年$CURRENT_MONTH月$CURRENT_DATE日 $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND $CURRENT_DAY_NAME",
"* @brief:\t$5",
"* @brief:\t$2",
"**********************************************************************************************************************************************************************************************************************************",
"**/"
],
Expand All @@ -269,26 +268,33 @@
"private":{
"prefix": "pri",
"body": [
"private:$0"
"private:",
"\t$0"
],
"description": "private snippet"
},
"public":{
"prefix": "pub",
"body": [
"public:$0"
"public:",
"\t$0"
],
"description": "public snippet"
},
"protected":{
"prefix": "pub",
"prefix": "pro",
"body": [
"protected:$0"
"protected:",
"\t$0"
],
"description": "protected snippet"
},
"template":{
"prefix":"tem",
"body":[
"template <typename $0>"
],
"description": "template snippet"
}




}

0 comments on commit 2692a51

Please sign in to comment.