本文介绍了如何让IntelliJ IDEA在“=”上对齐相邻的变量赋值。标志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

环境是IntelliJ IDEA 12.

Environment is IntelliJ IDEA 12.

我有环绕和支撑>分配声明>勾选多行时对齐。当我有相邻的属性时,它们是正确对齐的:

I've got Wrapping and Braces > Assignment Statement > Align when multiline ticked. When I have adjacent properties, they're aligned correctly:

private final CustomerFactory  customerFactory  = FactoryBuilder.getDefaultCustomerFactory ( );
private final RepFactory       repFactory       = FactoryBuilder.getDefaultRepFactory ( );
private final WarehouseFactory warehouseFactory = FactoryBuilder.getDefaultWarehouseFactory ( );

但是当我有相邻的变量赋值时,它们不是:

but when I've got adjacent variable assignments, they're not:

final Integer account30 = parseCurrency ( fields.get ( FIELD_OVERDUE_BALANCE_1 ) );
final Integer account60 = parseCurrency ( fields.get ( FIELD_OVERDUE_BALANCE_2 ) );
final Integer account90 = parseCurrency ( fields.get ( FIELD_OVERDUE_BALANCE_3 ) );
final Integer account120 = parseCurrency ( fields.get ( FIELD_OVERDUE_BALANCE_4 ) );
final Integer priceNumber = parseInteger ( fields.get ( FIELD_PRICE_NUMBER ), 1 );

这是次要的,但它让我很烦。任何人都可以告诉我,我可以做些什么来使这些相邻的变量声明对齐?我想要的是:

This is minor but it annoys me. Can anyone tell me what I can do to get these adjacent variable declarations aligned? What I want is:

final Integer account30   = parseCurrency ( fields.get ( FIELD_OVERDUE_BALANCE_1 ) );
final Integer account60   = parseCurrency ( fields.get ( FIELD_OVERDUE_BALANCE_2 ) );
final Integer account90   = parseCurrency ( fields.get ( FIELD_OVERDUE_BALANCE_3 ) );
final Integer account120  = parseCurrency ( fields.get ( FIELD_OVERDUE_BALANCE_4 ) );
final Integer priceNumber = parseInteger ( fields.get ( FIELD_PRICE_NUMBER ), 1 );

谢谢!

推荐答案

我认为您应该使用字段组 => 列对齐

I think you should be using the Field groups => Align in columns

当多线具有一些不适用于此处的其他效果时对齐。

Align when multiline has some other effect that doesn't apply here.

这篇关于如何让IntelliJ IDEA在“=”上对齐相邻的变量赋值。标志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 14:49