我不知道这个东西有没有名字,但是我想让一个大的相关代码块自动缩进/对齐。比如:
Before:
this._strategies = new Dictionary< Type, IStrategy >
{
{typeof( Station ), new StationStrategy(this)},
{typeof( Turnout ), new TurnoutStrategy(this)},
{typeof( EndOfLine ), new EndOfLineStrategy(this)},
{typeof( Chainage_Equality ), new ChainageEqualityStrategy(this)},
{typeof( Track_Connector ), new TrackConnectorStrategy(this)},
{typeof( Multimeter ), new MultimeterStrategy(this)},
{typeof( Power_Rail_Gap ), new PowerRailGapStrategy(this)},
{typeof( EndOfWire ), new EndOfWireStrategy(this)},
{typeof( Grounding_Point ), new GroundingPointStrategy(this)},
{typeof( Busbar ), new BusbarStrategy(this)},
{typeof( AARU ), new AutomaticAssuredReceptivityUnitStrategy(this)},
{typeof( TPS ), new TractionPowerSubstationStrategy(this)},
{typeof( AutoTransformer ), new AutotransformerStrategy(this)},
{typeof( Energy_Storage ), new EnergyStorageStrategy(this)},
};
之后:
this._strategies = new Dictionary< Type, IStrategy >
{
{typeof( Station ), new StationStrategy(this)},
{typeof( Turnout ), new TurnoutStrategy(this)},
{typeof( EndOfLine ), new EndOfLineStrategy(this)},
{typeof( Chainage_Equality ), new ChainageEqualityStrategy(this)},
{typeof( Track_Connector ), new TrackConnectorStrategy(this)},
{typeof( Multimeter ), new MultimeterStrategy(this)},
{typeof( Power_Rail_Gap ), new PowerRailGapStrategy(this)},
{typeof( EndOfWire ), new EndOfWireStrategy(this)},
{typeof( Grounding_Point ), new GroundingPointStrategy(this)},
{typeof( Busbar ), new BusbarStrategy(this)},
{typeof( AARU ), new AutomaticAssuredReceptivityUnitStrategy(this)},
{typeof( TPS ), new TractionPowerSubstationStrategy(this)},
{typeof( AutoTransformer ), new AutotransformerStrategy(this)},
{typeof( Energy_Storage ), new EnergyStorageStrategy(this)},
};
我知道Ctrl+K, Ctrl+F可以像这里建议的那样自动缩进,我一直在使用,但这不是我想要的。
我尝试手动制表符缩进代码,但我不想每次都这样做。 我正在寻找一个Visual Studio扩展程序。