Author Topic: Advanced Block Matching  (Read 2691 times)

Dennis

  • Senior Community Member
  • Posts: 3992
  • Hero Points: 520
Advanced Block Matching
« on: December 29, 2022, 03:41:32 PM »
Did you know that SlickEdit 2022 has enhanced block matching capabilities for C/C++, Java, and C#? 

For example, if you place your cursor on a switch statement and hit Ctrl+] (find-matching-paren), the cursor will move to the open brace for the statement, then pressing Ctrl+] again will move the cursor to the first case statement, and continue through each case statement until you hit the default and finally the closing brace, then it cycles back to the switch keyword.  You can pick up anywhere in this sequence, so if you are on a large case statement and want to move to the next case, you can just put the cursor on the case keyword and hit Ctrl+].

Another case of advanced block matching is chained if - else if - else statements.  If you start with your cursor on an if statement and hit Ctrl+] (find-matching-paren), the cursor will move to the first open brace.  Hitting Ctrl+] again will move the cursor to the close brace.  Hitting Ctrl+] again will move the cursor to the open brace of the first else if and then the close brace.  This continues until you hit the brace block for the else statement, and then will cycle back to the original if keyword.

Advanced block matching works similarly for chained try - catch - finally statements.

You can see the block matching illustrated in the SlickEdit interface in several ways:

1) If you have the option to highlight matching parenthesis enabled (Tools > Options > Editing > General > Parenthesis matching > Highlight matching blocks = ON, when you place the cursor on the keyword or braces in a match block, all the corresponding locations will be highlighted.

2) If you have the option to show statement outlining enabled (Document > {language mode} Options... > View > Selective Display > Outline > Statement level and (x) Show Lines) and the option to show block matching popups (Tools > Options > Appearance > General > Show block matching popups on mouse-over = ON), then when you move your mouse over the vertical lines showing the statement outline, a popup will display showing the first line, intermediate lines, and the last line of the block.