5

I don't know if there's a name for it, but I'd like to automatically indent(/tab?)-align my source for a large related block of code. Like so:

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)}, }; 

After:

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)}, }; 

I know of the Ctrl+K, Ctrl+F as suggested here, and I use that all the time but it's not what I'm looking for.

I've tried tabbing over the code manually but I don't want to do that every time.

I'm looking for a Visual Studio extension.

5
  • This extension may help, but everyone involved with the code must have it installed: alwaysaligned.net Commented Sep 8, 2016 at 13:00
  • @LucasTrzesniewski AlwaysAligned is what I want, but it's $40 per user. I was looking for something in the realm of $Free.99 Commented Sep 8, 2016 at 13:11
  • @Brandon there's also a big "download a free copy" button at the top of the page. Weird. Commented Sep 8, 2016 at 13:31
  • @MickyD Sure. Here's what I've done to solve the problem: I tab the characters over manually every time. Here's what I don't want to do: tab the characters over every time. I'll add it to the question. I was looking for a VS Extension, should've mentioned that. Thanks for the downvote though. Commented Sep 8, 2016 at 13:32
  • @LucasTrzesniewski Guess I overlooked and only saw the Buy Licenses button. Commented Sep 8, 2016 at 13:35

1 Answer 1

4

I was using Code Alignment VisualStudio extention for such purpose.

Here is what it can do(taken from official website)

 person.FirstName = "Chris"; => person.FirstName = "Chris"; person.Surname = "McGrath"; => person.Surname = "McGrath"; person.Age = 24; => person.Age = 24; person.Occupation = "Software Developer"; => person.Occupation = "Software Developer"; person.HomeTown = "Brisbane"; => person.HomeTown = "Brisbane"; 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.