15

When I first learned Java, I was using an IDE called "BlueJ." It had this feature called "Scope Highlighting" which made it very easy to read blocks of code. Now I've moved on from BlueJ and began using Eclipse. I'm currently in the process of customizing Eclipse to my liking and would like this Scope Highlighting feature inside Eclipse.

I've searched everywhere for an answer on how to do it but I cannot find any information pointing to a solution for doing it in Eclipse.

Here's a picture to demonstrate what Scope Highlighting looks like:

Notice the background color behind each method

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
David Meyer
  • 365
  • 2
  • 4
  • 13
  • Eclipse do not have this. I believe 3.8 can show the top and bottom delimiters of the current block, but not more than that. – Thorbjørn Ravn Andersen Aug 05 '12 at 23:28
  • NetBeans has code folding which allows you to collapse blocks of code. I assume Eclipse has something similar, but I am not sure since I have never used it. This might not be exactly the same, but it does allow you to see the nesting of your code. – Code-Apprentice Aug 05 '12 at 23:45

7 Answers7

28

I think the best option for you is EditBox, a scope highlighting plugin for Eclipse: http://editbox.sourceforge.net/

Utku Özdemir
  • 7,390
  • 2
  • 52
  • 49
  • 8
    EditBox appears to be exactly what the OP was looking for, they should change their selected answer. – Dobes Vandermeer Apr 17 '13 at 04:16
  • Yes I think this should be the voted answer. BTW does anybody know how to get EditBox to merge same scopes together? I have some code where i have new lines for spacing but here instead of 1 box I get multiple because each new line is breaking the scope – Anton Krug Mar 15 '15 at 19:40
  • EditBox allow us to color based on levels not based on block type like (for, if , try, catch, etc.) – Salman Sep 15 '15 at 05:29
9

I'm afriad that closest you can get is Shift + Alt + arrow_up

It is selecting wider block of code. pressing this few times will give you very similar result to what you are searching for. I use it often.. it is useful, also for refactoring.


EDIT: As @j2emanue said: you can just double click the delimiter (like a bracket) and it will highlight the entire scope.

Community
  • 1
  • 1
dantuch
  • 9,123
  • 6
  • 45
  • 68
  • Thanks for all the help. I'm going to submit a feature request to see if Scope Highlighting can be officially added. – David Meyer Aug 09 '12 at 22:43
6

you can use Shift + Alt + arrow_up but many people dont realize you can just double click the delimiter (like a bracket) and it will highlight the entire scope. Try double clicking your if statements bracket for example and watch eclipse highlight the entire scope. It works with any delimiter. so you can use parenthesis as well.

as a side note: if your using intelliji checkout this plugin works great: https://github.com/izhangzhihao/intellij-rainbow-brackets#screenshots

j2emanue
  • 60,549
  • 65
  • 286
  • 456
2

This isn't exactly what you're after but you can put your cursor in a method and then click the Show Source Of Selected Element only button on the toolbar. Your editor gets reduced to just that method. Click again and your back to your entire file. enter image description here

Tod
  • 8,192
  • 5
  • 52
  • 93
0

I doubt eclipse does have the same function as blue j.The best advise I can give you, is to change your theme to your liking which would enable you to easily select and highlight the block of code...and to customise your theme , go to http://eclipsecolorthemes.org/. ....

If you still have a problem, go to http://codejava.co.uk/contact.html and send your email.you can create a dummy one if want, then I will send you XML files I use for my eclipse themes.

0

can Bracketeer do this ? its an eclipse plug in ..

http://marketplace.eclipse.org/content/bracketeer-java-jdt#.UK6sY4fAdLc

j2emanue
  • 60,549
  • 65
  • 286
  • 456
0

Maybe you will also like the VSCode extension "Blockman". It highlights nested code blocks based on curly/square/round brackets, html/xml tags and Python/Yaml indentation. (I am the author of Blockman). . https://i.ibb.co/31F0rm9/vscode-blockman-intro-leodevbro-extension3.png . .

leodevbro
  • 113
  • 1
  • 9