Regions now available in VSCode Insiders Build version 1.17.0

Today, David Wilson from the PowerShell team at Microsoft, announced that Regions are now available in VSCode (Visual Studio Code) as of insiders build version 1.17.0.

I was hoping the region and endregion keywords would be case-insensitive unlike in the PowerShell ISE where they’re case-sensitive. It looks like that’s indeed what they intended since the region keyword is case-insensitive in VSCode, but unfortunately the endregion keyword is case-sensitive as shown in the following example.

There’s definitely a bug with either the region or endregion keyword since they should either both be case sensitive or both be case insensitive. If you want to make your code compatible with the PowerShell ISE, you’ll want to specify the region and endregion keywords in lower case since that’s the only way it will work in the ISE.

I’ve logged an issue on GitHub about this problem.

I didn’t realize that regions were such a controversial topic as seen in this thread on Twitter. I use them all the time in my demonstration scripts to organize my content when presenting.


Update
Maybe this is working as designed? If region is specified in lower case, then endregion must be specified in lower case, but if region is specified in mixed or upper case, then endregion can be specified in any case.

µ

1 Comment

  1. Luke

    Great news! Many were waiting for it since a while!

    Reply

Leave a Reply

%d bloggers like this: