【问题标题】:Prettier is not working in React Code and disappeared in status barPrettier 不在 React Code 中工作并在状态栏中消失
【发布时间】:2019-10-04 06:06:33
【问题描述】:

对不起,如果这个问题很愚蠢。我来自 Sublime Text,最近在我的 React 项目中使用 VSCode。我注意到状态栏中有一个带有勾号或叉号的 Prettier 状态,但我注意到它不再显示,而是显示 JavaScript 标准样式。我一直在尝试通过重新安装 Prettier、安装其他扩展来寻找一种方法让我的 Prettier 再次工作,但一切都不起作用。

我注意到的明显迹象是printWidth 选项在我的 VSCode 中不起作用。由于 JS Standard,我之前可能搞砸了配置,但是在 nuked 和重新安装 VSCode 之后,它根本无法解决问题。任何帮助或指针表示赞赏。提前致谢。

这是我的 .prettierrc.json。没有其他覆盖。

{
  "trailingComma": "es5",
  "tabWidth": 2,
  "semi": true,
  "singleQuote": true,
  "printWidth": 80
}

【问题讨论】:

    标签: visual-studio-code vscode-settings prettier


    【解决方案1】:

    转到文件 -> 首选项 -> 设置并搜索默认格式化程序并选择更漂亮 - 代码格式化程序

    或者

    在你的 vs 代码 settings.json 文件中添加这个 "editor.defaultFormatter": "esbenp.prettier-vscode",

    【讨论】:

      猜你喜欢
      • 2017-12-30
      • 1970-01-01
      • 2013-07-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-20
      • 1970-01-01
      相关资源
      最近更新 更多