简体   繁体   English

IntelliJ IDEA 禁用重新格式化 js、xml 代码

[英]IntelliJ IDEA disable reformat js, xml code

in our project.在我们的项目中。 when commit.提交时。 we have option: -reformat code -rearrange code -optimize imports.我们有选项:-reformat code -rearrange code -optimize import。 How can i disable this option for js and xml file?如何为 js 和 xml 文件禁用此选项? reformat and rearrange only java file.仅重新格式化和重新排列 java 文件。

UPD.更新。 It is possible since Intellij 2018.3.自 Intellij 2018.3 起就有可能。 Please see the documentation for details.有关详细信息,请参阅文档


Old reply:旧回复:

You can't.你不能。 Reformat is either enabled or disabled, for all files in a commit.为提交中的所有文件启用或禁用重新格式化。 See https://youtrack.jetbrains.com/issue/IDEA-167112https://youtrack.jetbrains.com/issue/IDEA-167112

As a workaround, you can commit files you don't want to be formatted separately.作为一种解决方法,您可以提交不想单独格式化的文件。 If you use Git, commit the second set with Amend, so there will still be one commit.如果您使用 Git,请使用 Amend 提交第二组,因此仍然会有一次提交。

You can exclude files with *.js and *.xml extensions from reformatting (permanently).您可以从重新格式化(永久)中排除带有*.js*.xml扩展名的文件。 Check the relevant documentation . 检查相关文档

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

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