[英]VSCode Prettier Format on Save messes up formatting
Been using VSCode Prettier format on save feature for a while.在保存功能上使用 VSCode Prettier 格式已经有一段时间了。
Lately is CONSTANTLY makes mistakes and misformats Javascript.最近总是犯错误和错误格式 Javascript。
For example:例如:
const foo = 123
[save] [救球]
const foo = 1;23
I've disabled it for now, but is there some way to make this not happen?我暂时禁用了它,但是有什么方法可以避免这种情况发生吗?
I do not think that there is a way to fix this.我认为没有办法解决这个问题。 I also use Prettier on my projects, and YES sometimes it is annoying.
我也在我的项目中使用 Prettier,是的,有时它很烦人。 I do not know if there are such specific configurations to solve your issue, but you cannot do anything else, except uninstalling or disabling the extension.
我不知道是否有这样的特定配置可以解决您的问题,但是除了卸载或禁用扩展程序外,您无能为力。
Remember, even if you do not choose to "prettify" your code on save , it will do it somewhen and the only option is to disable it.
请记住,即使您不选择在保存时“美化”您的代码,它也会在某个时候这样做,唯一的选择就是禁用它。
UPDATE 03-05-2020更新 03-05-2020
You can use the comment // prettier-ignore
in your files or nodes of code to ignore Prettier
formatting.您可以在文件或代码节点中使用注释
// prettier-ignore
来忽略Prettier
格式。
Reference & example: https://prettier.io/docs/en/ignore.html参考&示例: https://prettier.io/docs/en/ignore.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.