在触发之前,如何将输入到Visual Studio代码用户定义的代码段
我知道如何在VSCODE中制作代码片段。例如,要构建一个1-D数组,我已经定义了一个代码片段,如下所示 -
"Create a 1-dimensional Array": {
"prefix": "darr",
"body": [
"${1:Type}[] ${2:name} = new ${1:Type}[${3:Size}];",
"$4"
],
"description": "Creating a 1-dimensional Array"
}
工作正常。但是,这里有些事情正在减慢我的生产力,因为我必须在触发后一次又一次地按下该片段,从而给予数组类型,名称及其大小。
是否可以在触发vscode用户定义的片段中将这些详细信息提供给它?例如 - 如果我编写booleanarr10,则将创建一个代码为 - boolean [] arr = new boolean [10];
或者,如果我编写Intarr50,则它将创建一个代码为 - int [] arr = new Int [50];
甚至可以做到的扩展名也对我来说很好。 请建议。
I am aware of how to make code snippets in VSCode. For example, to build a 1-d array, I have defined a code snippet as shown below-
"Create a 1-dimensional Array": {
"prefix": "darr",
"body": [
"${1:Type}[] ${2:name} = new ${1:Type}[${3:Size}];",
"$4"
],
"description": "Creating a 1-dimensional Array"
}
Which is working perfectly fine. But here something is slowing down my productivity as I have to give array type, name and its size by pressing tab again and again to this snippet after triggering.
Is it possible to give these details to the vscode user defined snippet before triggering it? For example -
If I write booleanarr10, then it will create a code as - boolean[] arr = new boolean[10];
Or If I write intarr50, then it will create a code as - int[] arr = new int[50];
Even an extension that can do it is fine for me.
Please suggest.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论