Editor Auto-formatting - prevent formatting for regular expressions, where-object, etc

Use this forum to ask about non-product related topics (login issues, product registrations, web site questions, etc.) No technical support questions, please.
Forum rules
Do not post any licensing information in this forum.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
hkystar35
Posts: 2
Meble kuchenne na zamówienie - na wymiar - Wrocław
Joined: Fri Jun 05, 2020 3:32 pm

Editor Auto-formatting - prevent formatting for regular expressions, where-object, etc

Post by hkystar35 »

Is there a way to suppress auto-formatting for specific functions/cmdlets/regular expressions?
I love the formatting, especially the automatic formatting options. But I really think it looks awful when expressions and Where-Object calls are formatted to multiple lines:

I would like to exclude Where-Object or expression blocks from formatting because this is more readable:
  1. $Array = $Otheraray | Where-Object {$_.Property -eq $Value}
  2.  
  3. $Array | Select-Object @{L = "NewValue"; E = {$_.Property -replace '10', '11'}}
than this:
  1. $Array = $Otheraray | Where-Object {
  2.  
  3.     $_.Property -eq $Value
  4.  
  5. }
  6.  
  7. $Array | Select-Object @{
  8.  
  9.     L                              = "NewValue"; E = {
  10.  
  11.         $_.Property -replace '10', '11'
  12.  
  13.     }
  14.  
  15. }

User avatar
brittneyr
Site Admin
Posts: 481
Joined: Thu Jun 01, 2017 7:20 am

Re: Editor Auto-formatting - prevent formatting for regular expressions, where-object, etc

Post by brittneyr »

You can change the format settings in Options:
SPS_OptionsFormat.png
SPS_OptionsFormat.png (38.63 KiB) Viewed 139 times
Brittney Ryn
SAPIEN Technologies, Inc.

hkystar35
Posts: 2
Joined: Fri Jun 05, 2020 3:32 pm

Re: Editor Auto-formatting - prevent formatting for regular expressions, where-object, etc

Post by hkystar35 »

I'm very aware of the formatting settings, which is why I asked if there's a way to create an exception to the formatting rules for specific cmdlets/functions/expressions.

User avatar
brittneyr
Site Admin
Posts: 481
Joined: Thu Jun 01, 2017 7:20 am

Re: Editor Auto-formatting - prevent formatting for regular expressions, where-object, etc

Post by brittneyr »

There currently is no way to set specific formatting rules. You are welcome to file a feature request here and we will see what we can do:
https://www.sapien.com/requests
Brittney Ryn
SAPIEN Technologies, Inc.