Powershell studio over indenting splatted parameters

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER 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.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 3 years and 1 week old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
PaulHarman
Posts: 1
Last visit: Tue Nov 09, 2021 6:21 am

Powershell studio over indenting splatted parameters

Post by PaulHarman »

To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product, version and build: 5.8.187
Operating system: Server 2016
PowerShell version(s): 5.1.14393.3866

*** Please add details and screenshots as needed below. ***

DO NOT POST LICENSES, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM

How do I stop Powershell Studio for over indenting the values for my parameters?
1.png
1.png (103.13 KiB) Viewed 3220 times
2.png
2.png (84.49 KiB) Viewed 3220 times
  1.         $sqlparameters = @{
  2.             ServerInstance  = "xxx"
  3.             Database        = "xxx"
  4.             Query           = " Declare @ID int;
  5.                                 select @ID =  MAX(id) FROM RequestAction;
  6.                                 INSERT INTO dbo.RequestAction
  7.                                 (
  8.                                 ID,
  9.                                 RequestID,
  10.                                 ActionTypeID,
  11.                                 ActionDate,
  12.                                 ActionByID,
  13.                                 Description,
  14.                                 DateLogged,
  15.                                 LoggedByID,
  16.                                 ActivityID,
  17.                                 CreatedBy
  18.                             )
  19.                             VALUES
  20.                                 (  @ID +1 ,         -- ID - int
  21.                                 $($ref),         -- RequestID - int
  22.                                 1,         -- ActionTypeID - int
  23.                                 GETDATE(), -- ActionDate - datetime
  24.                                 'Script',        -- ActionByID - varchar(10)
  25.                                 N'$($comment)',       -- Description - nvarchar(max)
  26.                                 GETDATE(), -- DateLogged - datetime
  27.                                 '',        -- LoggedByID - varchar(10)
  28.                                 NULL,         -- ActivityID - int
  29.                                 N''        -- CreatedBy - nvarchar(500)
  30.                             )"
  31.             Username       = "xxx"
  32.             Password        = "xxx"
  33.         }
  34.         Invoke-Sqlcmd @sqlparameters
User avatar
brittneyr
Site Admin
Posts: 1649
Last visit: Mon Mar 18, 2024 1:47 pm
Answers: 38
Been upvoted: 30 times

Re: Powershell studio over indenting splatted parameters

Post by brittneyr »

Thank you for reporting this behavior. I have been able reproduce this behavior from the code snippet you provided. I will talk with the development team and get back to you when I have more information.
Brittney
SAPIEN Technologies, Inc.
User avatar
brittneyr
Site Admin
Posts: 1649
Last visit: Mon Mar 18, 2024 1:47 pm
Answers: 38
Been upvoted: 30 times

Re: Powershell studio over indenting splatted parameters

Post by brittneyr »

I have determined that the issue is with the format setting Align hashtable equal signs in Options->Formatting->Formatting:
SPS_OptionsFormattingAlignEqual.png
SPS_OptionsFormattingAlignEqual.png (31.21 KiB) Viewed 3200 times
Unchecking this prevented the over-indenting behavior.
Brittney
SAPIEN Technologies, Inc.
This topic is 3 years and 1 week old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.