Structure View - Element Display Order

Issue #318 resolved
Clio K created an issue

Currently the Structure View sorts the class elements (methods etc) by name.

Not having an "as appears in the class" view is really impacting my daily workflow.

A structure view that has all the functions of the standard IDEA Java structure view would be ideal. A simple structure view modification of sorted or not would be a huge improvement.

Comments (18)

  1. Scott Wells repo owner

    Clio, can you elaborate on how this is impacting your workflow? I'm curious about how you're using the structure view such that order matters. I'm not sure if this would be related, but are you aware of the Next/Previous Method keystrokes (Alt Down/Up in Windows/Linux and Ctrl Down/Up in Mac)? I support those in Illuminated Cloud for fast navigation not only between methods but also other class members.

  2. Scott Wells repo owner

    Also, can you elaborate on what from the standard IDEA Java structure view is missing (that would also be present in Apex)? Looking at the Java structure view, I see three options:

    1. Show inherited members
    2. Show anonymous classes (not present in Apex)
    3. Narrow down on typing

    Members are shown in alphabetic order, though grouped with inner classes before methods before fields, so that would be the only notable difference I see. Perhaps I'm missing some other config options?

    Thanks!

  3. Clio K reporter

    The buttons on the Structure toolbar in Illuminated Cloud are:

    • Show inherited
    • Expand all
    • Collapse all
    • Auto scroll to
    • Auto scroll from

    The buttons on the Structure toolbar in the standard Java editor are:

    • Sort A to Z
    • Sort Z to A
    • Group methods by type
    • Show properties
    • Show fields
    • Show inherited
    • Show anonymous classes
    • Expand all
    • Collapse all
    • Auto scroll to
    • Auto scroll from

    The two functions of the most interest here would be the sort buttons. A show fields function would be nice but its not a pain point for me.


    I use the structure view as an outline view of the class. It makes it easy to review what a class does and how it is organized without having to read the code.

    I tend to organize my class methods by function and visibility (use) starting with the constructors.

    An unsorted example:

    public class SuperUpdate() {
    public SuperUpdate()...
    public void doReport()..
    private void reportStart()...
    private void reportMiddle()...
    private void reportHelper()...
    private void reportFinsh()...
    private void dataReader()...
    public void doProcessing()..
    private void processingStart()...
    private void processingMiddle()...
    private void processingHelper()...
    private void processingFinsh()...
    

    A quick review of an unsorted structure view shows this class does a report and some processing. The report has 5 helper methods and the processing has 4 helper methods. If it was a real example you could likely get a good idea what the private helper methods do from their names. You could even make a stretch assumption that the report might run before the processing.

    A sorted example:

    public class SuperUpdate() {
    public SuperUpdate()...
    private void dataReader()...
    public void doProcessing()..
    public void doReport()..
    private void processingHelper()...
    private void processingFinsh()...
    private void processingMiddle()...
    private void processingStart()...
    private void reportHelper()...
    private void reportFinsh()...
    private void reportMiddle()...
    private void reportStart()...
    

    As you can see in this example much of this information is lost and/or much harder to gather.

    Another way you can think of it is that the structure view is a table of contents of a book. Its not nearly as useful sorted as it would be in the actual order of the book. If you want a index view click a sort button.

    Also keep in mind that this is a trivially small example. The issues get compounded quickly when working on larger, complex production code. Classes with 30 to 40 methods and 1k to 3k lines are not uncommon for what I work on.

    BTW

    I wanted to say thank you for creating Illuminated Cloud. I am sure it added years to my life when I stopped using the Eclipse plugin. It really was that madding and getting worse with every release.

  4. Scott Wells repo owner

    Aha! I pretty much use the structure popup exclusively and not the docked structure view. Yes...there are WAY more options there. Gotcha. I'll take a look at supporting some of those as well when I can come up for air after I wrap up Lightning support and a few other things.

    And I'm happy to hear that I've extended your life! Thanks for the kind words!

  5. Clio K reporter

    I was hoping that after a year there could at least be an us-sorted view in the structure view.

    In addition there is an issue that the auto scroll to source from the structure view stops working until you exit and reenter the IDE. Seems to happen every few minuets or so. I am not sure what the trigger is but is something in the common dev workflow.

    Both of these issues are quite annoying.

  6. Scott Wells repo owner

    Hi, Clio. You're right...this did drop below my radar, so I apologize for that. I'll see if I can work in some of the structure view options for ordering in a near-term release. I'll have to see if I can reproduce the issue you're seeing with auto-scroll to source, but if I'm unable to do so I may need you to provide some logs from when it's happening to you.

  7. Scott Wells repo owner

    I just submitted structure view sorting by visibility and alphabetic ordering. This will be in the next build.

  8. Scott Wells repo owner

    I've been unable to reproduce the issue where auto-scroll stops working. The next time that happens, please send me your idea.log which will hopefully contain the underlying issue details.

  9. Clio K reporter

    Great! Thanks for the update. I am looking forward to it.

    I have been having a hard time getting a reproducible case of the structure auto scroll stopping to work. I think it has something to do with a failed save/deploy with a structure error (like a missing } etc.). An IDE restart fixes the issue. Fixing the structure and saving does not.

    I'll open another issue if I have something actionable for you. I just thought I would mention it as you where likely poking around in that part of the code.

  10. Scott Wells repo owner

    Okay. I just uploaded 1.7.9.3. I'm going to resolve this for the requested enhancements around sorting. As you've offered, please log additional issues, bugs or enhancements as appropriate. Thanks!

  11. Clio K reporter

    I just tried it out. Unless I am missing something, unchecking the A->Z button (and the visibility sort button) does not display the structure in the as-written order, which is the feature I was looking for.

  12. Scott Wells repo owner
    • changed status to open

    Well, ugh...I swear that when I implemented/tested this the other day I was getting natural ordering when neither of the sort toggles were clicked, but I'm seeing the same behavior you describe. I'll revisit and include the real fix in the next build. Sorry 'bout that!

  13. Scott Wells repo owner

    I found it. I'm going to post a build with that change here for you to verify if you don't mind, and assuming it's good you can run that build until I push the next official update which will include it.

  14. Scott Wells repo owner

    Okay, let's try this. It's just 1.7.9.3 with a second take on the fix for this issue. Note that the pop-up structure view is still alphabetically ordered just as in Java, but the docked structure view should be ordered according to the declarations themselves when the visibility/alpha sort toggles are unchecked.

    To install this build, just download the attached .zip file and, from within IntelliJ IDEA, use Settings>Plugins>Install plugin from disk. This won't interfere with updates to official builds at all.

    Please let me know if this doesn't properly address the issue.

  15. Scott Wells repo owner

    Thanks for confirming and sorry for the false start! That's already checked into my release branch and will be included in the next official release.

  16. Log in to comment