繁体   English   中英

更漂亮的扩展在 vs 代码中不起作用

[英]Prettier extension not working in vs code

我正在尝试在 vs 代码中使用 Prettier,但几天后它并没有格式化我的代码。 几天前它工作得很好,但现在不行。 它在设置中给了我错误。json。 我的 settings.json 就像

    {
    "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
    "emmet.includeLanguages": {
        "javascript": "javascriptreact"
    },
    "editor.fontSize": 20,
    {
        "window.zoomLevel": 2,
        "liveServer.settings.donotShowInfoMsg": true,
        "editor.formatOnSave": true,
        "prettier.jsxSingleQuote": true,
        "prettier.singleQuote": true
    }
}

它在第 7 行给了我错误

我也遇到过同样的问题。

  1. 选择VS Code -> View -> Command Palette ,然后输入: Format Document With
  2. 然后Configure Default Formatter..然后选择Prettier - Code formatter

这解决了我的问题。

我如何在我的 Linux 机器上修复它。

  1. Go 到 VS Code Settings -> type formatter -> 选择 Prettier - Code formatter 作为 Default Formatter
  2. 还有 select 格式保存

这为我修好了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM