PowerShell Studio: Code Formatting
- Details
- Written by David Corrales
- Last Updated: 21 April 2016
- Created: 10 June 2014
- Hits: 13580
Often times when you paste a PowerShell script from the web, the lines aren’t indented correctly. With the PowerShell Studio’s code formatting, it will automatically indent your script.
Formatted After Paste:
Customizable Formatting:
PowerShell Studio’s code formatting is customizable to fit your needs:
Formatting Triggers:
The first few options serve as triggers for auto formatting. These options tell PowerShell Studio when to format your script.
The following triggers can be enabled:
- When a user inserts a new line ie. presses Enter (Formats the line only).
- When a script block is completed by typing the closing curly bracket } (Formats the code block).
- When a user types a semicolon ; (Formats the line only).
- When a user pastes text into the editor (Formats the pasted content).
In addition, there is an option to automatically indent the appropriate tab depth when inserting a new line.
Formatting Rules:
The second set of options allow you to customize the formatting rules of PowerShell Studio.
Place open brace on new line:
Enabled
Disabled
Place statement keyword on newline:
Enabled (with open brace new line: disabled)
Disabled (with open brace new line: disabled)
Align parameter on line continue `:
Enabled
Disabled
Parameter Block Indent:
Indents the parameter declarations within a parameter block.
Align parameter attributes:
Vertically aligns a parameter’s attributes declarations. When disabled it uses the Attribute Parameter indent value instead, to indent the subsequent lines of attributes.
If you have any suggests or formatting options you would like to see added, please post a comment in our Wish List and Features Request forum.
For licensed customers, use the forum associated with your product in our Product Support Forums for Registered Customers.
For users of trial versions, please post in our Former and Future Customers - Questions forum.