One of the new features we added to PowerShell Studio 2014 is code formatting. PowerShell Studio 2014 will now beautify your script while you type or when you paste content.
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:
PowerShell Studio 2014’s code formatting is customizable to fit your needs:
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.
The second set of options allow you to customize the formatting rules of PowerShell Studio 2014.
Place open brace on new line:
Place statement keyword on newline:
Enabled (with open brace new line: disabled)
Disabled (with open brace new line: disabled)
Align parameter on line continue `:
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.
Let us know what you think. 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.