Eclipse:使用自定义间距查看文档,使用文件间距保存 [英] Eclipse: view a document using custom spacing, save using the file's spacing

查看:95
本文介绍了Eclipse:使用自定义间距查看文档,使用文件间距保存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对日食有一个愚蠢的用例:



在工作中,他们使用2个空格作为制表符。缩进看起来非常紧凑,我发现缩进妨碍了可读性。



现在,我不能设置Eclipse为选项卡使用4个空格,因为它将编辑我更改的任何文件,并且显然不想违反编码



因此,我可以在保留原始间距的情况下在文档上自定义视图吗?



欢呼声

解决方案

(不完全是日食答案,但可以使用)

将您的源代码与git之类的SCM组合,您可以在其中定义 VCS,这很容易设置。


I have a silly use case for eclipse:

At work, they use 2 spaces for a tab character. Indentation looks really squashed and I'm finding it obstructs readability.

Now, I can't set Eclipse to use 4 spaces for a tab as it'll edit any files I change, and obviously don't want to violate the coding standards.

So, can I have a custom view onto my document, with saving maintaining the original spacing?

Cheers

解决方案

(Not exactly an "eclipse" answer, but it can work)
Combine your source code with a SCM like git, where you can define a custom filter driver with a smudge/clean process:

Each time you checkout and fill your working directory, all .java files will be written with 4 spaces.
But each time you commit them, they will be stored with 2 spaces.

Then, whatever current VCS you are using (SVN, Perforce, ...) will take those (git) commit files and will commit them in turn (but with the right format).
Since you can embed a Git repo inside any workspace of any other central VCS, this can be easy to setup.

这篇关于Eclipse:使用自定义间距查看文档,使用文件间距保存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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