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:
Comments below can no longer be edited.
Evgeny Gerashchenko says:
September 30, 2011Cool! I have waited for this feature for a long time!
Igor Kolomiets says:
September 30, 2011Denis, if I were your manager I would punish you for brown color scheme 🙂
Denis.Zhdanov says:
September 30, 2011Fyi, that’s a standard gnome theme
Igor Kolomiets says:
September 30, 2011I know. Unfortunately many Linux products harmed by untasteful aesthetics. IDEA is not that kind of product though 🙂
Alex says:
October 1, 2011That’s nice. But is It possible to add some navigation buttons (like scroll down) instead of “…” signs?
Denis.Zhdanov says:
October 3, 2011Please submit corresponding feature request to the tracker.
Aardwolf says:
October 4, 2011I’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!
Denis.Zhdanov says:
October 4, 2011@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?
Geoffrey De Smet says:
October 10, 2011Nice, this paper cut has bothered me a lot in the past. Ironically, I always needed to see the 101th element it seems…
ammar bozorgvar says:
September 30, 2014thank you
Lenny Miller says:
April 19, 2016This is helpful – thx! However, the vertical list of values leaves most of the Variables debug window with white-space. Being able to view more data on a single (and scroll-able) screen would be helpful when scanning large arrays for a pattern. Is there a way to change the layout (of the “adjusted” variable values) to a multi-row (array) format (like the Unix od command)? I’d be happy to create a ticket if it’s not available, and you think it makes sense. Thx.
MilanG says:
February 25, 2018Would be useful to watch array of arrays as table.