You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[folding] shift+click should only fold inner ranges #78557
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
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.
"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.
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.
Activity
aeschli commentedon Aug 19, 2019
In VSCode, Shift + Click recursively folds the range and all contained ranges.
So for what you want you can press
Shift + ClickandClick[-][Folding] Folding fold-able sub-parts by Shift+click the arrow[/-][+][folding] shift+click should only fold inner ranges[/+]mmahmoudian commentedon Aug 24, 2019
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:
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.
GustavoASC commentedon Dec 8, 2019
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.GustavoASC commentedon Dec 8, 2019
Mehrad Mahmoudian (@mmahmoudian)
I would like to point this part out:
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.
mmahmoudian commentedon Dec 18, 2019
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.
aeschli commentedon Dec 19, 2019
Ok, let's give this a try. I hope this doesn't break other users. We can still add an other modifier key.
aeschli commentedon Dec 20, 2019
I made the following improvement:
That way shift+click always does something and you can loop the states.
Let me know what you think.
[folding] shift+click folds region when no children to collapse (for #…
GustavoASC commentedon Dec 24, 2019
Martin Aeschlimann (@aeschli) Good idea!! I liked it.