Is there any way to have all local variables aligned in Eclipse?
Eclipse has a great feature to allow you to align all your 'fields in columns' meaning that it will turn:
开发者_如何学Goint myVar = 2334;
int asdf = 34;
String s = "hello";
into
int myVar = 2334;
int asdf = 34;
String s = "Hello";
This makes the code a lot more readable and I love it. However I can't seem to find a similar setting to make it do that for regular local variables. Anyone know if there is a way? It'd be a shame if there isn't one.
Thanks
If you go in Eclipse's settings, Java -> Code Style -> Formatter, you may edit or create a new profile.
Anyway, in the Indentation
tab, there is an "Align fields in columns" option that should do what you are looking for.
Window --> Preferences --> Java --> Code Style --> Formatter
- Create a New Profile
- check Align fields in columns
- click ok
- Select all variables declared.
- Ctrl + Shift + F
精彩评论