Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>ies-replaceNew to Visual Studio Code? Get it now.
ies-replace

ies-replace

wiselee

|
38 installs
| (1) | Free
可以使用正则替换文件内容
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

基础使用

  • 命令行 ies-replace,进行选择配置内容
  • 默认选项配置 humps 下划线转换成驼峰命名 underline 驼峰命名转换成下划线命名
  • 最低兼容 VS Code 版本1.63.0

自定义配置

  • 配置项字段会自动加入选择列表中
  • 修改配置后,不生效需要重新打开编辑器

setting.json 配置

{
  // JSON方式配置函数
  "regular.expressions": {
    /**
     *   key: 自定义命令
     *   value: 字符串函数,参数接收文件内容
     */
    "template": "(content)=>{return content}"
  },
  // 配置文件路径
  "regular.configPath": "/project/.vscode",
  // 配置文件命名
  "regular.configName": "project.config.js"
}

CJS 配置

  • 默认配置,需要在项目根路径.vscode 中,创建 ies.replace.config.js 文件
  • 指定配置文件路径,setting.json > regular.configPath
  • 指定配置文件名称,setting.json > regular.configName
  • 文件需要符合 CJS 规范
// 自定义配置函数
const template = (content) => {
  const header = `/**
 * @Author: wiseLee
 * @Date: ${new Date()}
 * ......
 */`;
  return `${header}
${content}`;
};
module.exports = {
  template,
};
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft