If you are like me, then it is easy to miss a bracket or two in my source code. Or I have tons of closing brackets at the end of a function, and it is hard to tell which one is which? Eclipse comes with basic bracket support: you select/click a bracket, and it helps you to find the closing one. I was pretty happy about that, unless I saw a list of most popular Eclipse plugin. One plugin stood out of the masses in the Top 10 Most Popular New Eclipse Plugins review: Bracketeer. That plugin exactly helps me to solve my problem: which bracket is which?
It would be really cool to know to which code block each ‘}’ belongs. And Bracketeer can do this for me!
To install the plugin, use the menu Help > Install New Software and point the Eclipse updater to following site:
Bracketeer comes with support for CDT (C/C++) and JDT (Java). Just install for what you have installed in your Eclipse IDE.
The plugins installs a new toolbar with 3 functions:
- It shows matching brackets surrounding the cursor. I simply can place my cursor somewhere in the code, and it shows me the different levels of surrounding brackets in different color:
- It shows matching brackets while hovering over it. Similar to the ‘cursor’, but only if hover with the mouse cursor. And it shows just the matching bracket:
- And this is the coolest thing of all! It shows hints in the editor view:
The really cool thing of the last features is that it does auto-commenting: It shows you the corresponding block condition in the source view, *without* touching the source code.
Plus it allows you as well to use a hyperlink to the corresponding block: simply press CTRL and use your mouse to jump to the block other end:
Plus it informs me about unpaired/wrong brackets too:
Bracketeer has as well rich settings where you can configure the look and feel of it:
Happy Bracketeering :-)