Intellij 重新格式化文件保存 [英] Intellij reformat on file save

查看:25
本文介绍了Intellij 重新格式化文件保存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我记得在 IntelliJ 或 Eclipse 中看到了在保存文件时重新格式化(清理)文件的设置.我如何找到它(在设置中没有找到)

解决方案

我建议

配置:

似乎最近版本的 Intellij 保存操作插件是由自动 Intellij 保存触发的.当它在编辑时被点击时,这可能会很烦人.

这个插件的github问题给出了一些可能的解决方案的提示:

https://github.com/dubreuia/intellij-plugin-保存操作/问题/63

我实际上尝试将重新格式化分配给 Ctrl+S 并且它工作正常 - 现在自动完成保存.

I remember seeing in either IntelliJ or Eclipse the setting to reformat (cleanup) files whenever they are saved. How do I find it (didn't find it in the settings)

解决方案

I suggest the save actions plugin. It also supports optimize imports and rearrange code.

Works well in combination with the eclipse formatter plugin.

Search and activate the plugin:

Configure it:

Edit: it seems like it the recent version of Intellij the save action plugin is triggered by the automatic Intellij save. This can be quite annoying when it hits while still editing.

This github issue of the plugin gives a hint to some possible solutions:

https://github.com/dubreuia/intellij-plugin-save-actions/issues/63

I actually tried to assign reformat to Ctrl+S and it worked fine - saving is done automatically now.

这篇关于Intellij 重新格式化文件保存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆