Issue with regions

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.
User avatar
PsCustomObject
Posts: 120
Last visit: Thu Jun 09, 2022 11:45 am

Issue with regions

Post by PsCustomObject »

Product: PowerShell Studio 2022 (64 Bit)
Build: v5.8.206
OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.22000.0

Hello, as per subject I am facing a weird issue with regions. I have a foreach loop which I'm trying to enclose in a region problem is code is collapsed correctly when no region is present:
NoRegion.png
NoRegion.png (3.16 KiB) Viewed 1794 times
But as soon as I place a #region tag I am not able to fold neither the code nor the region itself
The attachment REgion_NoFold.png is no longer available
Weirdly enough this seems to affect only newly created regions, I already have plenty of them in my codebase and they're working as intended.

I have tried to leave couple of blank lines between the region definition and the code itslef but still issue persists, this seems to kick in when creating region with folded code (I have a hundred of so lines of code in between) which is automatically expanded and causing this to show itself.

I will try to reproduce this in a reliable way but that's what I observed in a rather consistent way on my end.

Thanks!
Attachments
REgion_NoFold.png
REgion_NoFold.png (5.99 KiB) Viewed 1794 times
User avatar
brittneyr
Site Admin
Posts: 1126
Last visit: Tue Jun 21, 2022 3:31 pm
Answers: 25
Been upvoted: 20 times

Re: Issue with regions

Post by brittneyr »

Can you please provide a screenshot of your Editor (Options->Editor) and Format (Options->Formatting) settings in Options:
SPS_OptionsEditor.png
SPS_OptionsEditor.png (31.76 KiB) Viewed 1779 times
SPS_OptionsFormatting.png
SPS_OptionsFormatting.png (30.74 KiB) Viewed 1779 times

Did you manually add the region or did you use the ribbon (Home->Edit->Regions)?
Brittney Ryn
SAPIEN Technologies, Inc.
User avatar
PsCustomObject
Posts: 120
Last visit: Thu Jun 09, 2022 11:45 am

Re: Issue with regions

Post by PsCustomObject »

Thanks, I actually did both.

I tried manually adding the region but also used the built-in menu/keyboard shortcut, same result.

I'm attaching requested screenshots
Attachments
Formatting2.png
Formatting2.png (27.36 KiB) Viewed 1761 times
Formatting1.png
Formatting1.png (26.62 KiB) Viewed 1761 times
User avatar
brittneyr
Site Admin
Posts: 1126
Last visit: Tue Jun 21, 2022 3:31 pm
Answers: 25
Been upvoted: 20 times

Re: Issue with regions

Post by brittneyr »

Upon formatting the script (Home->Edit), does this bring back the collapse/expand functionality for the regions?
Does this behavior persist after opening and closing the script?
Brittney Ryn
SAPIEN Technologies, Inc.
User avatar
PsCustomObject
Posts: 120
Last visit: Thu Jun 09, 2022 11:45 am

Re: Issue with regions

Post by PsCustomObject »

I just checked and both formatting and closing/re-opening the script (but the whole editor does not change) has no effect and issue seems to persist.
User avatar
brittneyr
Site Admin
Posts: 1126
Last visit: Tue Jun 21, 2022 3:31 pm
Answers: 25
Been upvoted: 20 times

Re: Issue with regions

Post by brittneyr »

Is it just happening on a particular script or can you replicate it on any script?

Can you please upload a script with this behavior:
https://www.sapien.com/support/upload
Brittney Ryn
SAPIEN Technologies, Inc.
User avatar
PsCustomObject
Posts: 120
Last visit: Thu Jun 09, 2022 11:45 am

Re: Issue with regions

Post by PsCustomObject »

Apologies for the late reply, I think this was a temporary quirk with the code I was working on.

just ignore this and if I'm able to reproduce this consistently I will report back.

Thanks!