【问题标题】:Visual studio code: replace char case while typing in snippetVisual Studio 代码:在输入代码片段时替换字符大小写
【发布时间】:2018-07-07 07:26:54
【问题描述】:

我正在尝试为 Visual Studio Code 和 TypeScript 编写 code-sn-p。到目前为止,我设法像这样镜像输入的单词:

import { ${1:Name}Component } from './${1:name}.component';

当我在 #1 位置输入单词时,它会镜像到 #2 位置,如下所示:

import { MynameComponent } from './Myname.component';

是否可以将 sn-p 更改为 #2 为小写,如下所示:

import { MynameComponent } from './myname.component';

【问题讨论】:

标签: angular typescript visual-studio-code code-snippets


【解决方案1】:

最近在 vscode v.1.25 中添加了转换 sn-ps 的功能。在你的情况下试试这个 sn-p:

"import components": {
    "prefix": "isml",
    "body": [
      "import { ${1/(.*)/$1Component } from '.\\/${1:/downcase}/}.component'",
    ],
    "description": "small"
  },

触发前缀。然后在输入组件名称(本例中为 Myname)后点击 tab,它将根据需要完成 sn-p。

import { MynameComponent } from './myname.component';

【讨论】:

    猜你喜欢
    • 2012-05-13
    • 1970-01-01
    • 2020-09-07
    • 2016-11-17
    • 2011-07-05
    • 2014-03-27
    • 2020-09-22
    • 1970-01-01
    相关资源
    最近更新 更多