有没有办法让 Eclipse 中的所有局部变量对齐?
Eclipse 有一个很棒的功能,允许您对齐所有“列中的字段”,这意味着它将变成:
int myVar = 2334;
int asdf = 34;
String s = "hello";
这
int myVar = 2334;
int asdf = 34;
String s = "Hello";
使得代码更具可读性,我喜欢它。但是,我似乎找不到类似的设置来使其对常规局部变量执行此操作。有人知道有没有办法吗?如果没有的话就太可惜了。
谢谢
Eclipse has a great feature to allow you to align all your 'fields in columns' meaning that it will turn:
int 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果你进入 Eclipse 的设置,Java ->代码风格->格式化程序,您可以编辑或创建新的配置文件。
无论如何,在“缩进”选项卡中,有一个“对齐列中的字段”选项,应该可以满足您的需求。
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.窗口 -->偏好设置 --> Java -->代码风格 -->格式化程序
Window --> Preferences --> Java --> Code Style --> Formatter