Additional code folding configuration options

Issue #274 resolved
Brett Carroll created an issue

As a user I would like to fold all code blocks in order to improve readability of code.

Comments (20)

  1. Scott Wells repo owner

    Brett, first off, love the "As a ... so that I can ..." form of the acceptance criteria! As for the actual request, just wanted to clarify whether you're asking for code folding in general or for the ability to fold more types of blocks than those that are currently available for folding? I'm assuming the latter. If so, could you provide the ones that are most important to you?

    FYI, the current code folding options in Illuminated Cloud are directly modeled after the options in IntelliJ IDEA's own Java editor that have analogous concepts in Apex.

  2. Brett Carroll reporter
    Given that there is an if, for, while, do-while, try, catch, object initializer block in my current document
    when the document is loaded in the text editor
    Then there should be folding icons in the gutter to the left functioning the same as intelliJ's existing folding functionality
    
    Given that there are folding icons in the gutter to the left for a code block
    When I left click either one
    Then they should fold the code for that block the same as intelliJ's existing folding functionality
    
    // This is something that I just thought of that is *way* optional and may not be in line with industry standards
    Given that there are folding icons in the gutter to the left for a code block
    When I right click either one
    Then they should recursively fold all blocks within the scope of the block I am folding.
    
  3. Brett Carroll reporter

    The above acceptance criteria the list of code blocks is in no particular order.

    if
    

    and

    for
    

    are huge for me, but the others would be nice.

  4. Scott Wells repo owner

    Thanks, Brett. I'll definitely keep this in the backlog for consideration once I wrap up my current queue of items.

  5. Murat Berk

    I would like this also, but in a different context. I do not like very long methods, so not folding if/while etc although very useful, does not effect the view for me since I can fold whole method, this helps a lot with 1000 line files.

    But what I want to see is support for static initializer blocks for static lists/maps etc (outside method context) so we can fold multi line initializers to a single line and improve readability of the code.

    Thanks

  6. Scott Wells repo owner

    I am planning to circle back around to this but probably not for a bit. I'm just about finished with a big push on metadata management features and enhancements, and next on my list is improved LWC support. Once that's done I'll likely turn back to editor features such as this and new refactorings, new code inspections/intentions, etc.

  7. Jason Clark

    Not sure how it’s implemented in the underlying Intelli-J model, but any place we have curly braces ({, }) in Apex, I’d like to have the option to fold. This should cover all of the stated use cases: for, if, while, do-while, try, catch, static blocks, and static collection intializers, in addition to class and method level folding (which already works).

  8. Scott Wells repo owner

    It only took me 4.5 years from when this was originally opened, but I finally got around to adding more code folding regions, specifically all braced code blocks, array/list/map instance initializers, and bracketed queries in query expressions. These changes will be included in the next build which should be released later this week.

  9. Log in to comment