[英]JavaScript and typescript shared snippets in vscode
I have created quite a lot of custom JavaScript snippets in VsCode . 我在VsCode中创建了很多自定义JavaScript代码段。 Recently, I started working on a project in typescript and, not unexpectedly, the JavaScript snippets do not work in typescript files.
最近,我开始在打字稿中处理项目,而且并不奇怪,JavaScript代码段在打字稿文件中不起作用。
Is there a way to create "shared" snippets that I could use both in JavaScript and typescript? 有没有一种方法可以创建我可以在JavaScript和打字稿中使用的“共享”片段? (apart from copying the snippet definition files every time I create a custom snippet)
(除了每次创建自定义代码段时复制代码段定义文件)
You can create global snippets and scope them: 您可以创建全局代码片段并对其进行范围划分:
Preferences: Configure User Snippets
Preferences: Configure User Snippets
板Preferences: Configure User Snippets
New Global Snippets File
"console.log": {
"scope": "typescript,javascript,typescriptreact,javascriptreact",
"prefix": "cl",
"body": "console.log($0);",
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.