Reputation: 2658
I custom a snippet in VS code.And code as below:
"angular2-logger": {
"prefix": "log",
"body": [
"this.log.log('$1');"
],
"description": "使用angular2-logger的log功能"
}
But what if wanna add more snippets?Who can give me a demo?
Upvotes: 5
Views: 5791
Reputation: 15
After ending your 1st snippet you can add a comma after the }
and create another snippet as you did before.
For example: (snippet for c++, note the comma)
"#include": {
"prefix": ["#include", "basic"],
"body": [
"#include<iostream>\r",
"#include<conio.h>\r",
"using namespace std;\r",
"int main()\r",
"{\r",
"\r",
"}"],
"description": "basic starting code"
},
"cout": {
"prefix": "count",
"body": [
"cout<<\"${1:entercode}\";",
""
],
"description": "cout"
}
Upvotes: 0
Reputation: 2252
Just add a comma in the end after the parentheses and create your next snippet.
For example:
"angular2-logger": {
"prefix": "log",
"body": [
"this.log.log('$1');"
],
"description": "使用angular2-logger的log功能"
},
"Console.log": {
"prefix": "log",
"body": [
"console.log($1);"
],
"description": "Console.log"
}
Upvotes: 7