【问题标题】:VSCode snippet for importing Angular Material Modules用于导入 Angular 材质模块的 VSCode 片段
【发布时间】:2021-04-07 17:11:55
【问题描述】:

我想创建一个 sn-p tom 导入一个像这样的角度材料模块

import { MatToolbarModule } from "@angular/material/toolbar";
etc.

这是我到目前为止所做的:

"Import Angular Material Modules": {
        "prefix": "ng-mat-import",
        "body": [
            "import { Mat${1}Module } from '@angular/material/${1/(.*)/downcase/$1}'",
        ]
    },

我不知道缺少什么以及出了什么问题。 VSCode 文档太模糊了。

我想得到的结果类似于Visual studio code: replace char case while typing in snippet 中的答案

【问题讨论】:

  • 使用后会得到什么?
  • 对不起,我会更新问题

标签: visual-studio-code code-snippets vscode-snippets


【解决方案1】:

转换语法中有几处不完整:

"import { Mat${1}Module } from \"@angular/material/${1/(.*)/${1:/downcase}/}\";",

我还使用\" 包含双引号,因为您想要的最终结果似乎表明您想要而不是单引号。如果您只想要单引号,则无需转义。

"import { Mat${1}Module } from '@angular/material/${1/(.*)/${1:/downcase}/}';",

【讨论】:

    猜你喜欢
    • 2018-11-15
    • 1970-01-01
    • 2018-11-24
    • 1970-01-01
    • 1970-01-01
    • 2020-09-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多