【问题标题】:Transform and regex in Code Snippets in VSCode - DocsVSCode 代码片段中的转换和正则表达式 - Docs
【发布时间】:2018-07-07 22:28:29
【问题描述】:

我需要转换列表,例如小写、大写、大写。 这样的清单在哪里?很好的文档。

【问题讨论】:

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


    【解决方案1】:

    官方文档是snippets grammar。它显示了转换,但仅提供了一个示例。内置变换是

    /upcase or /downcase or /capitalize or /pascalcase
    

    /pascalcase 于 2018 年 10 月 2 日由 a commit 添加,但尚未纳入文档(截至 2019 年 6 月)。它可以做到这一点:

    some-file-name.js => SomeFileName // 或其他分隔符,如 _ 或任何 [^a-z]/i 字符。

    由于最近增强了 sn-p 转换的能力,请参阅 placeholder transforms, v1.25 release notes(还有另一个示例),应该很快就会有更多示例到达。

    例如,请参阅capitalized a snippet

    transform foo_bar to FooBar, camelCase

    capitalize classNames of variableslowercase a component name.

    【讨论】:

      猜你喜欢
      • 2021-04-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-12
      • 2021-02-05
      • 2021-10-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多