开发者

Eclipse: view a document using custom spacing, save using the file's spacing

开发者 https://www.devze.com 2022-12-23 17:12 出处:网络
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 obs开发者_StackOverflowtructs readability.

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 obs开发者_StackOverflowtructs 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:

Eclipse: view a document using custom spacing, save using the file's spacing

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消