在Eclipse IDE中(或者在我的例子中是STS
),对于java文件,关于:删除所有行上的尾随空格,我可以执行以下操作:
具体是如何在中描述的:
因此,从上图可以看出:
Remove trailing white spaces on all lines
直到一切正常,但对于开发,我们有其他扩展名的文件。因此,我需要为非java文件提供相同的功能,例如:.xml
、.js
、.gradle
、.html
、.css
、.properties
、.sql
文件等。
我找不到一个特定的部分来实现这一点。
如何完成此必需的配置?
发布于 2018-08-15 03:09:46
不幸的是,Eclipse中没有自动删除尾随空格的通用解决方案。请参见:
打开Eclipse Bug 180349 - Remove trailing spaces as an option while saving files.
有两种方法可以安装它:
- Enter [http://andrei.gmxhome.de/eclipse/](http://andrei.gmxhome.de/eclipse/) as the URL in the **Work with** field.
- Select **AnyEditTools** option for all recent releases of Eclipse (3.8+), and complete the wizard.
使用Eclipse > Marketplace...的
- Enter _AnyEdit_ in the **Find** field to locate the **AnyEdit Tools** plugin.
- Click the **Install** button.
一旦Eclipse重新启动,当你保存任何文件时,插件应该会自动删除任何文件的尾随空格,而不管文件的类型或扩展名。例如:
这个插件适合我在Photon上使用。
AnyEdit还可以做很多其他的事情。以下是已安装插件的摘要:
为文本文件和编辑器添加了有用的上下文菜单操作-打开文件,在光标下键入,将制表符转换为空格,大小写,html,base64,unicode,比较/替换为剪贴板或外部文件等。AnyEdit可以删除尾随空格和/或在保存时转换制表符-空格,并有助于导入/导出工作集向导。
有关更多详细信息,请参阅the web site for the plugin。
https://stackoverflow.com/questions/51847075
复制相似问题