Skip to content

[folding] shift+click should only fold inner ranges #78557

Closed

Description

In other IDEs like Rstudio Shift+click on the arrows near the line number folds the fold-able sub parts of that part.

Peek 2019-08-06 14-34

This is very handy since it only folds everything within the scope of a specific region and can help user to have a better view on the sub-parts.

Activity

  1. aeschli commented on Aug 19, 2019

    @aeschli
    Contributor

    In VSCode, Shift + Click recursively folds the range and all contained ranges.

    So for what you want you can press Shift + Click and Click

  2. changed the title [-][Folding] Folding fold-able sub-parts by Shift+click the arrow[/-] [+][folding] shift+click should only fold inner ranges[/+] on Aug 19, 2019
  3. mmahmoudian commented on Aug 24, 2019

    @mmahmoudian
    Author

    Martin Aeschlimann (@aeschli) your "solution" to address this works and I appreciate the suggestion and also title modification, but I think you also agree that it is very un-intuitive since achieving something should not be through doing something (recursive folding: SHIFT+Click) first and undoing something else (normal unfolding: Click).

    I would also like to raise a point here:
    recursive folding is very useless since you are folding the top level as well and you are not seeing the inner ranges to know if they are folded or not. This makes it also confusing since one cannot know if something is previously normally folded or recursively (there is no icon difference but the editor have memorized it internally!).

    The best solution would be SHIFT+Click:

    • "fold inner ranges" if the current range is unfolded
    • "open the range with inner ranges folded" if the current range is folded

    This way the user don't get any surprises when unfolding a range and can control if the inner ranges should be folded or unfolded while unfolding a range.

  4. added
    feature-request
    on Oct 10, 2019
  5. GustavoASC commented on Dec 8, 2019

    @GustavoASC
    Contributor

    Martin Aeschlimann (@aeschli) do you guys of VSCode Team agree with Mehrad Mahmoudian (@mmahmoudian) suggestion?
    Because if you agree, I can try to contribute making a pull request with this change.

    It looks like a simple change at /vs/editor/contrib/folding/folding.ts file where foldingModel.toggleCollapseState() method is invoked.

  6. GustavoASC commented on Dec 8, 2019

    @GustavoASC
    Contributor

    Mehrad Mahmoudian (@mmahmoudian)
    I would like to point this part out:

    "open the range with inner ranges folded" if the current range is folded

    I think you meant: "open the range with inner ranges unfolded" if the current range is folded.
    Because RStudio has this second behavior when current range is folded.

    Anyway, I made these changes on my local VSCode fork and I think it's really nice. This way we have simpler control over inner ranges.

  7. mmahmoudian commented on Dec 18, 2019

    @mmahmoudian
    Author

    Gustavo Cassel (@GustavoASC) Thanks for putting some effort into this and ultimately #86626.

    Regarding your last comment, I'm a bit lost. What I was/am after is to force inner ranges ("child nodes" if we think about it as XML-like hierarchy) folded while the user is at the outer range (parent node). The logic/rationale I have is simple: codes tend to be large and typically segmented by inner ranges. The programmer would usually want to navigate through the code and understand it's structure, so it is necessary to start from abstract view (inner ranges folded) and get the general gist of what the current range is doing and then start expanding the inner ranges one by one to explore them if needed. Needless to say that a good code is well commented and has an organized structure.

    I hope my brief explanation above has clarified my point.

  8. aeschli commented on Dec 19, 2019

    @aeschli
    Contributor

    Ok, let's give this a try. I hope this doesn't break other users. We can still add an other modifier key.

  9. aeschli commented on Dec 20, 2019

    @aeschli
    Contributor

    I made the following improvement:

    • when doing shift+click and all children are already folded (or there are no children), then the current region is also folded
      shift-click-on-fold

    That way shift+click always does something and you can loop the states.

    Let me know what you think.

  10. GustavoASC commented on Dec 24, 2019

    @GustavoASC
    Contributor

    Martin Aeschlimann (@aeschli) Good idea!! I liked it.

  11. locked and limited conversation to collaborators on Feb 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

editor-foldingfeature-requestverification-neededverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions