打开软件->左下角设置->用户代码片段->选中对应的配置文件(比如我写python,就在python.json中配置)
{
// Place your snippets for python 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"
// }
"set utf-8": { // 配置名字
"prefix": "utf", // 输入前没有补全的代码
"body": [
"# -*- coding=utf-8 -*-", //输入后补全的代码
"$0" // $0代表光标最后停留的位置
],
"description": "set_utf-8" // 提示的内容
},
"set main": {
"prefix": "main",
"body": [
"if __name__ == '__main__':",
"$0"
],
"description": "set main"
},
"set init": {
"prefix": "init",
"body": [
"def __init__(self):",
"$0"
],
"description": "set init"
},
"set next": {
"prefix": "init",
"body": [
"def __next__(self):",
"$0"
],
"description": "set next"
},
"set iter": {
"prefix": "init",
"body": [
"def __iter__(self):",
"$0"
],
"description": "set iter"
}
}