【问题标题】:Parentheses disappear after formatting in vscodevscode格式化后括号消失
【发布时间】:2020-04-22 04:40:25
【问题描述】:

我在vscode中把这个语句写在js里:

   el.style.width = (this.elementWidth + round * 10) + "px";

在自动保存/格式化(更漂亮)之后变成这样:

   el.style.width = this.elementWidth + round * 10 + "px";

如何更改设置以保留括号而不关闭更漂亮的格式?

【问题讨论】:

  • 在这种特殊情况下,您确定更改后的代码不能正常工作吗?我强烈不同意该工具正在做什么,但在这里我认为第一个 + 仍然应该是数字加法。

标签: javascript visual-studio eslint prettier


【解决方案1】:

看起来您描述的行为是 old, long-discussed issue,他们 prettier 不愿意修复

【讨论】:

    猜你喜欢
    • 2021-05-25
    • 2022-11-04
    • 2018-08-14
    • 2019-04-25
    • 2013-11-04
    • 1970-01-01
    • 2023-04-10
    • 2019-01-04
    • 1970-01-01
    相关资源
    最近更新 更多