Add snippets

This commit is contained in:
全卓 2022-08-24 12:30:14 +08:00
parent 41ee0b00be
commit d704c3b289
2 changed files with 65 additions and 0 deletions

View File

@ -59,6 +59,12 @@
"CMakeCache"
]
}
],
"snippets": [
{
"language": "cmake",
"path": "./snippets.json"
}
]
},
"scripts": {

59
snippets.json Normal file
View File

@ -0,0 +1,59 @@
{
"Function": {
"prefix": "function",
"body": [
"function($1)",
"\t$2",
"endfunction()"
]
},
"While Loop": {
"prefix": "while",
"body": [
"while($1)",
"\t$2",
"endwhile()"
]
},
"Foreach Loop": {
"prefix": "foreach",
"body": [
"foreach(VAR $1)",
"\t$2",
"endforeach()"
]
},
"If Condition": {
"prefix": "if",
"body": [
"if($1)",
"\t$2",
"endif()"
]
},
"CMake Minimum Version": {
"prefix": "cmake_minimum_required",
"body": "cmake_minimum_required(VERSION $1)"
},
"Project Command": {
"prefix": "project",
"body": [
"project($1",
" VERSION $2",
" LANGUAGES C CXX",
" DESCRIPTION \"$3\")"
]
},
"Add An Executable": {
"prefix": "add_executable",
"body": "add_executable($1)"
},
"Add A Library": {
"prefix": "add_library",
"body": "add_library($1)"
},
"Link Libraries": {
"prefix": "target_link_libraries",
"body": "target_link_libraries($1)"
}
}