最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

JavaScript and typescript shared snippets in vscode - Stack Overflow

programmeradmin1浏览0评论

I have created quite a lot of custom JavaScript snippets in VsCode. Recently, I started working on a project in typescript and, not unexpectedly, the JavaScript snippets do not work in typescript files.

Is there a way to create "shared" snippets that I could use both in JavaScript and typescript? (apart from copying the snippet definition files every time I create a custom snippet)

I have created quite a lot of custom JavaScript snippets in VsCode. Recently, I started working on a project in typescript and, not unexpectedly, the JavaScript snippets do not work in typescript files.

Is there a way to create "shared" snippets that I could use both in JavaScript and typescript? (apart from copying the snippet definition files every time I create a custom snippet)

Share Improve this question edited Jan 18, 2019 at 13:32 user3382203 1791 gold badge6 silver badges26 bronze badges asked Jan 17, 2019 at 23:15 Tomas DohnalTomas Dohnal 2,0252 gold badges18 silver badges17 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 26

You can create global snippets and scope them:

  • From command palette Preferences: Configure User Snippets
  • New Global Snippets File

"console.log": {
    "scope": "typescript,javascript,typescriptreact,javascriptreact",
    "prefix": "cl",
    "body": "console.log($0);",
},
发布评论

评论列表(0)

  1. 暂无评论