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!
Installation
To install the plugin, use the menu Help > Install New Software and point the Eclipse updater to following site:
chookapp.github.com/ChookappUpdateSite/
Bracketeer comes with support for CDT (C/C++) and JDT (Java). Just install for what you have installed in your Eclipse IDE.
Features
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:
Cool, eh?
Preferences
Bracketeer has as well rich settings where you can configure the look and feel of it:
Happy Bracketeering ๐
Thanks a lot
LikeLike
awesome plugin! i was finally able to style my eclipse closing brackets / braces like netbeans already styles brackets by default
LikeLike
Could it be used for files that are not ending in a .cpp or .h extension? I am interested to use it for any extension file.
thanks
LikeLike
Bracketeer is for CDT (C/C++) and JDT (Java) development. I tried it with .txt (text files), and it is not working on these files. As I believe it depends on the Eclipse indexer and parser, it only works on files which are supported by the Eclipse parser (e.g. CDT and JDT). So if you have your very own files, then you probably need to extend the Bracketeer code.
LikeLike
Pingback: Constructing a Classroom IDE with Eclipse for ARM | MCU on Eclipse
This may be useful ๐ I will give it a try! Thanks for the tip!
LikeLike
So sad it does not work with the new Eclipse versions (2019, 2020). Anyone found an alternative?
LikeLike
Is there really a need for an alternative? That article was in 2012, and since then Eclipse has improved and added good bracket matching/display, so I had no need for that plugin any more.
LikeLike
Matching is fine, but Eclipse does not show “comments” at the closing brackets that shows (part of) the statement before the opening bracket. It is enormously helpful if that statement is a few pages above…
Yeah I can double click at the position before the closing bracket, so that the whole block is selected, and afterwards step left with the cursor to jump to the line of the opening bracket…then check the line and navigate back to the end of the block… just enough actions to lose focus ๐ฆ
LikeLike
Thanks!
LikeLike