Debugger: working with sub-ranges for arrays and lists

During debugging IntelliJ IDEA shows only the first 100 elements of arrays and collections. It’s enough in most cases. However, it’s sometimes convenient to use a custom range. Exactly for this the ‘Adjust Range’ action has been available for arrays for quite a long time. But recently we’ve made a couple of improvements to it. Namely:

  • ‘Adjust Range’ works with lists now
  • adjusted range is preserved for local variables delivered to another stack frame

Quick demonstration example:

  1. Start debugger and wait until target break point is hit;
  2. Right click on target array/list and select the ‘Adjust Range…’ action:
  3. Define a range:
  4. Check the result:
This entry was posted in Tips & Tricks and tagged . Bookmark the permalink.

10 Responses to Debugger: working with sub-ranges for arrays and lists

  1. Evgeny Gerashchenko says:

    Cool! I have waited for this feature for a long time!

  2. Igor Kolomiets says:

    Denis, if I were your manager I would punish you for brown color scheme :)

  3. Denis.Zhdanov says:

    Fyi, that’s a standard gnome theme

  4. Igor Kolomiets says:

    I know. Unfortunately many Linux products harmed by untasteful aesthetics. IDEA is not that kind of product though :)

  5. Alex says:

    That’s nice. But is It possible to add some navigation buttons (like scroll down) instead of “…” signs?

  6. Denis.Zhdanov says:

    Please submit corresponding feature request to the tracker.

  7. Aardwolf says:

    I’d actually like to have, instead, a menu option there which does not make you type numbers to adjust a range or so, but instead opens a dialog with a scrollbar with the whole array in it (if needed capped at 10000 or so values with a “more” button at the bottom). I think it’s much easier to debug your problem if you can have a nice visual representation of the whole thing in one self contained dialog, than if you need to twiddle with numbers in popup menu options and collapsible tree controls!

    But it sure is a step forward!

  8. Denis.Zhdanov says:

    @Aardwolf: I’d say that it’s a slightly different use-case because the blogged facility allows not only show values beyond the default limits but hide non-interesting values as well.

    However, I agree that ‘more’ control would be handy during debugging. Can I ask you to create corresponding ticket request?

  9. Geoffrey De Smet says:

    Nice, this paper cut has bothered me a lot in the past. Ironically, I always needed to see the 101th element it seems…

  10. ammar bozorgvar says:

    thank you

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">