• 安装jsfmt
    光安装jsfmt是不行的,还需要esformatter 和esformatter -jsx这两个插件
  • 安装esformatter 和 esformatter-jsx
    npm i [email protected] [email protected]
  • 修改配置文件
  • 修改jsfmt的setting-user
    {
    “extensions”:
    [
    “js”,
    “jsx”,
    “sublime-settings”
    ],
    “options”: {
    “plugins”: [
    “esformatter-jsx”
    ],
    “jsx”: {
    “formatJSX”: true,
    // change these to your preferred values
    // refer to https://github.com/royriojas/esformatter-jsx#best-configuration for more options
    “attrsOnSameLineAsTag”: false,
    “maxAttrsOnTag”: 1,
    “firstAttributeOnSameLine”: false,
    “alignWithFirstAttribute”: true
    }
    // other esformatter options
    }
    }
  • 配置快捷键
    找到key bindings-user文件,加入
    {
    “keys”:[“ctrl+q”],
    “command”:”format_javascript”
    }
    React的代码格式化插件jsfmt

相关文章:

  • 2021-05-02
  • 2021-06-30
  • 2022-12-23
  • 2021-11-08
  • 2021-08-26
  • 2021-07-27
  • 2021-12-04
  • 2021-12-15
猜你喜欢
  • 2021-11-24
  • 2021-06-15
  • 2022-01-04
  • 2022-01-07
  • 2022-01-03
  • 2021-08-10
相关资源
相似解决方案