Support Forums

PowerShell Studio Request - Format Script Enhancements

Post feature requests, product enhancement ideas, and other product-specific suggestions here. Do not post bug reports.
Forum rules
Do not post any licensing information in this forum.
User avatar
Helocheck
Posts: 29
Joined: Tue Apr 29, 2014 1:55 am

PowerShell Studio Request - Format Script Enhancements

Postby Helocheck » Sat Jan 30, 2016 10:00 am

Hello all,

just recently purchased PSS 2015 and I fell in love with the features and the ability to easily create GUIs which can be redistributed but thought propose couple of enhancement/ideas that I loved in the previous product I was using.

Remove Aliases

I know there is an option and a keybord shortcut but yet it would be nice if the Format Script button could expand any alias in the script automatically, I know this could sound minor but as it is best practice not to use aliases in scripts I think it would be nice to have this automatically fixed by PSS.

Enforce proper use of single vs double quotes

I think the title says it all, generally speaking it is a good habit to use single quotes by default unless we want PowerShell to make changes to the text or expand a variable within quotes.

Again this is not essential but reinforces good habits and would make it easier to stick to them.

Better formatting for long line of commands

I think an example is better than thousand words, I'm from Switzerland and the CSV delimeter over here is ";" rather than "," so someitmes it is handy to format output in place with a command similar to the following

foreach ($csv in $reportFile) { (Get-Content $csv) | ForEach-Object -Process { $_ -replace ',', ';' } |Set-Content $csv }}


It will run and it is readable but I think this is much nicer/easier to read and follow

foreach ($csv in $reportFile) 
{
(Get-Content $csv) |
ForEach-Object -Process {
$_ -replace ',', ';'
} |
Set-Content $csv
}


Again non essential but when you're dealing with many scripts somtime written by other people who ignore (or are to lazy to follow) best practices it makes it easier to have your IDE fix human shortcomings.

Hope the above will make sense and if any further detail can be helpful please let me know and I'll be more than glad to elaborate further.

If I had to make a choice the last function/option is the one I would like to see implemented but guess that is a matter of personal taste.

Cheers L.

*EDIT* The script review rules I'm talking about are coming from here https://www.powershellgallery.com/packa ... On/0.6.2.0 which can be imported into standard Windows ISE.
User avatar
davidc
Posts: 4448
Joined: Thu Aug 18, 2011 4:56 am

Re: PowerShell Studio Request - Format Script Enhancements

Postby davidc » Mon Feb 01, 2016 3:10 pm

Remove Aliases

You can expand all aliases by pressing [Ctrl + Shift + A]. We are looking at adding an option to expand aliases into the code formatter.

Enforce proper use of single vs double quotes

We definitely are look into incorporating the Script Analyzer into the editor.

Better formatting for long line of commands

The formatter always leaves open and closed brackets that are on the same line as is. I can add a feature request to the wishlist for an option to change this behavior.
It looks like you would also like an option to insert a newline after the pipe character? Is this correct?

David
David
SAPIEN Technologies, Inc.
User avatar
Helocheck
Posts: 29
Joined: Tue Apr 29, 2014 1:55 am

Re: PowerShell Studio Request - Format Script Enhancements

Postby Helocheck » Tue Feb 02, 2016 1:33 am

First of all thanks for taking your time to read/consider and answer the post, I really appreciate it.

davidc wrote:
You can expand all aliases by pressing [Ctrl + Shift + A]. We are looking at adding an option to expand aliases into the code formatter.


Yep thanks I was aware about the keyboard shortcut and getting used to it, as I said this is not essential but for lazy people like me having the IDE handling this automatically would be nice.

davidc wrote:Enforce proper use of single vs double quotes

We definitely are look into incorporating the Script Analyzer into the editor.


This is great indeed and looking forward it!

davidc wrote:
The formatter always leaves open and closed brackets that are on the same line as is. I can add a feature request to the wishlist for an option to change this behavior.
It looks like you would also like an option to insert a newline after the pipe character? Is this correct?

David


Yes you got the point.

Again many thanks for considering this!

L.

Return to “Wish List and Feature Requests”

Who is online

Users browsing this forum: No registered users and 2 guests