【发布时间】:2021-11-23 11:58:44
【问题描述】:
假设我想为打字稿界面创建一个 VSCode sn-p,如下所示:
interface MyInterface{
prop1: string;
prop2: string;
prop3: string
}
现在我可以创建以下 sn-p:
"myinterface": {
"prefix": "myinterface",
"body": [
"interface MyInterface{ ",
" prop1: string; ",
" prop2: string;",
" prop3: string",
"}"
],
"description": "not smart interface creator"
}
但如果我想在我的界面中添加prop4、prop5 或prop6,该怎么办?无论如何有条件地扩展sn-p,以便通过点击Tab 会提示我向接口添加另一个prop 字段,格式为 ${1:propX}: ${2:string};?
另一个用例是写出一个数组:
const myArray = [val1, val2, val3]
【问题讨论】:
标签: visual-studio-code code-snippets vscode-snippets