Find Matching Brace (or Parenthesis)

by May 8, 2013

One common headache are non-matching braces or parentheses in PowerShell scripts. So when you write a script, it is recommended to align matching braces and parentheses and make your code more readable this way.

In addition, PowerShell 3.0 ISE editor helps identify the matching counterpart. When you position the cursor right before a brace or parenthesis, the matching one gets highlighted. Unfortunately, the highlight color is light gray so you may not have noticed this before.

If the matching counterpart is not visible, you can press CTRL+] (or choose Edit-Go to match in the menu). It is selectable only when the cursor is positioned right before a brace or parenthesis.

On a side note, this menu item has been wrongly localized in some cultures. In Germany, for example, "match" was translated with "game", so you may have wondered what "games" you could play in ISE when you looked at the menu item before).

Twitter This Tip! ReTweet this Tip!