{"id":7418,"date":"2014-06-10T09:00:21","date_gmt":"2014-06-10T17:00:21","guid":{"rendered":"http:\/\/www.sapien.com\/blog\/?p=7418"},"modified":"2014-05-30T09:51:21","modified_gmt":"2014-05-30T17:51:21","slug":"powershell-studio-2014-code-formatting","status":"publish","type":"post","link":"https:\/\/dev.sapien.com\/blog\/2014\/06\/10\/powershell-studio-2014-code-formatting\/","title":{"rendered":"PowerShell Studio 2014: Code Formatting"},"content":{"rendered":"<p>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.<\/p>\n<p>Often times when you paste a PowerShell script from the web, the lines aren\u2019t indented correctly. With the PowerShell Studio\u2019s code formatting, it will automatically indent your script.<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/05\/image10.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/05\/image_thumb9.png\" alt=\"image\" width=\"244\" height=\"87\" border=\"0\" \/><\/a><\/p>\n<p>Formatted After Paste:<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/05\/image11.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/05\/image_thumb10.png\" alt=\"image\" width=\"244\" height=\"87\" border=\"0\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Customizable Formatting:<\/strong><\/p>\n<p>PowerShell Studio 2014\u2019s code formatting is customizable to fit your needs:<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/05\/image12.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/05\/image_thumb11.png\" alt=\"image\" width=\"244\" height=\"174\" border=\"0\" \/><\/a><\/p>\n<p><em><strong>Formatting Triggers:<\/strong><\/em><\/p>\n<p>The first few options serve as triggers for auto formatting. These options tell PowerShell Studio when to format your script.<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/05\/image13.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/05\/image_thumb12.png\" alt=\"image\" width=\"244\" height=\"115\" border=\"0\" \/><\/a><\/p>\n<p>The following triggers can be enabled:<\/p>\n<ol>\n<li>When a user inserts a new line ie. presses Enter (Formats the line only).<\/li>\n<li>When a script block is completed by typing the closing curly bracket }\u00a0 (Formats the code block).<\/li>\n<li>When a user types a semicolon ; (Formats the line only).<\/li>\n<li>When a user pastes text into the editor (Formats the pasted content).<\/li>\n<\/ol>\n<p>In addition, there is an option to automatically indent the appropriate tab depth when inserting a new line.<\/p>\n<p><em><strong>Formatting Rules:<\/strong><\/em><\/p>\n<p>The second set of options allow you to customize the formatting rules of PowerShell Studio 2014.<\/p>\n<p>Place open brace on new line:<\/p>\n<p><em>Enabled<\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/05\/image14.png\" alt=\"image\" width=\"247\" height=\"152\" border=\"0\" \/><br \/>\n<em>Disabled<\/em><br \/>\n<img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/05\/image15.png\" alt=\"image\" width=\"247\" height=\"152\" border=\"0\" \/><\/p>\n<p>Place statement keyword on newline:<\/p>\n<p><em>Enabled (with open brace new line: disabled)<br \/>\n<img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/05\/image15.png\" alt=\"image\" width=\"247\" height=\"152\" border=\"0\" \/><\/em><\/p>\n<p><em>Disabled (with open brace new line: disabled)<br \/>\n<img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/05\/image16.png\" alt=\"image\" width=\"247\" height=\"152\" border=\"0\" \/> <\/em><\/p>\n<p>Align parameter on line continue `:<\/p>\n<p><em>Enabled<\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/05\/image17.png\" alt=\"image\" width=\"320\" height=\"101\" border=\"0\" \/><\/p>\n<p><em>Disabled<\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/05\/image18.png\" alt=\"image\" width=\"320\" height=\"101\" border=\"0\" \/><\/p>\n<p>Parameter Block Indent:<br \/>\nIndents the parameter declarations within a parameter block.<\/p>\n<p><em>Indent: 1<\/em><\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/05\/SNAGHTML145d742.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"SNAGHTML145d742\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/05\/SNAGHTML145d742_thumb.png\" alt=\"SNAGHTML145d742\" width=\"244\" height=\"103\" border=\"0\" \/><\/a><\/p>\n<p>Indent: 0<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/05\/image19.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/05\/image_thumb13.png\" alt=\"image\" width=\"244\" height=\"103\" border=\"0\" \/><\/a><\/p>\n<p>Align parameter attributes:<\/p>\n<p>Vertically aligns a parameter\u2019s attributes declarations. When disabled it uses the Attribute Parameter indent value instead, to indent the subsequent lines of attributes.<\/p>\n<p><em>Enabled<\/em><br \/>\n<a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/05\/SNAGHTML1483f28.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"SNAGHTML1483f28\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/05\/SNAGHTML1483f28_thumb.png\" alt=\"SNAGHTML1483f28\" width=\"244\" height=\"103\" border=\"0\" \/><\/a><\/p>\n<p><em>Disabled with Indent: 1<\/em><br \/>\n<a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/05\/SNAGHTML149e97a.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"SNAGHTML149e97a\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/05\/SNAGHTML149e97a_thumb.png\" alt=\"SNAGHTML149e97a\" width=\"244\" height=\"103\" border=\"0\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>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 <a href=\"http:\/\/sapien.com\/forums\/viewforum.php?f=9\">Wish List and Features Request forum<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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\u2019t indented correctly. With the PowerShell Studio\u2019s code formatting, it will automatically [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[703,632,25],"tags":[915,28,874,141],"class_list":["post-7418","post","type-post","status-publish","format-standard","hentry","category-powershell-studio","category-whats-new-software-news","category-windows-powershell","tag-code-formatting","tag-powershell","tag-powershell-studio-2014","tag-whats-new"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/7418","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/comments?post=7418"}],"version-history":[{"count":2,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/7418\/revisions"}],"predecessor-version":[{"id":7461,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/7418\/revisions\/7461"}],"wp:attachment":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/media?parent=7418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/categories?post=7418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/tags?post=7418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}