Search code examples
phpstormsublimetext

PHPStorm: Jump to matching brace/bracket/parentheses like in SublimeText


In PHPStorm and SublimeText there are hotkeys for going to the matching brace/bracket/parentheses.

In SublimeText this is very intuitive: When directly at said character, you can jump to the matching character and from there you can jump back (symmetrically). When not directly at a brace/bracket/parentheses, you will move to the closest one.

In PHPStorm this is not at all intuitive. The matching is not symmetrical and sometimes no matched character is found at all, even though it is highlighted in the editor.

Is there any way to make PHPStorm behave like SublimeText in this regard?

Here are two simple examples that show the problem (cursor is marked with C1, C2 etc.):

Example 1

$x = C1[C2
    'foo', 'bar',C3
C4]C5;

Cursor at C1

  • SublimeText: Cursor goes to C5
  • PHPStorm: Cursor does not move

Cursor at C2

  • SublimeText: Cursor goes to C4
  • PHPStorm: Cursor goes to C1

Cursor at C3

  • SublimeText: Cursor goes to C4
  • PHPStorm: Cursor goes to C1

Cursor at C4

  • SublimeText: Cursor goes to C2
  • PHPStorm: Cursor does not move

Cursor at C5

  • SublimeText: Cursor goes to C1
  • PHPStorm: Cursor goes to C4

Example 2

if C1(C2 'foo' ===C3 'bar' C4)C5 C6{C7

C8}C9

Cursor at C1

  • SublimeText: Cursor goes to C5
  • PHPStorm: Cursor does not move

Cursor at C2

  • SublimeText: Cursor goes to C4
  • PHPStorm: Cursor goes to C1

Cursor at C3

  • SublimeText: Cursor goes to C4
  • PHPStorm: Cursor goes to C1

Cursor at C4

  • SublimeText: Cursor goes to C2
  • PHPStorm: Cursor goes to C1

Cursor at C5

  • SublimeText: Cursor goes to C1
  • PHPStorm: Cursor goes to C4

Cursor at C6

  • SublimeText: Cursor goes to C9
  • PHPStorm: Cursor goes to C9

Cursor at C7

  • SublimeText: Cursor goes to C8
  • PHPStorm: Cursor goes to C9

Cursor at C8

  • SublimeText: Cursor goes to C7
  • PHPStorm: Cursor goes to C7

Cursor at C9

  • SublimeText: Cursor goes to C6
  • PHPStorm: Cursor does not move

Edit: A very similar behaviour is described at https://youtrack.jetbrains.com/issue/IDEA-12068 which would already be an improvement.


Solution

  • The IDEA at https://youtrack.jetbrains.com/issue/IDEA-12068 (as suggested by LazyOne) was changed to state "fixed" at 25 Sep 2015. It seems to be integrated since PHPStorm 10.0. Feels good now :)