Collapse all (with code folding) except current cursor point.

Hi there! 

Just wondering if there is a way with code folding to collapse all, but keep the current point expanded? 

Thanks! 

Pete

0
5 comments

Hi Pete,

Unfortunately, this is not possible in any IntelliJ-based IDE including Rider. Here is the feature request: https://youtrack.jetbrains.com/issue/IDEA-113564

A possible workaround is to Collapse All, then select a range that you'd like to have expanded and call Expand All on it.

0

Thanks Julia,
I found that if I press the shortcut for Collapse All, then immediately press the shortcut for Expand a few times, it works pretty well.
I guess the cursor keeps its position after the collapse.

P.

0

Julia's point above is JUST what I was looking for. 

When I enter a new file, I like everything collapsed except top-level stuff (methods/test names/or whatever) so I can see the full overview, then I like to expand fully whatever section I'm working on. Didn't realise you could select the line and press expand-all, that is so useful, thanks!

0

I'm not sure how, but somehow my IDE (WebStorm Build #WS-243.21565.180, built on November 12, 2024) did exactly this request.  While this is really useful, it wasn't what I was used to and confused me.  Even if I tried to collapse only the current block, it wouldn't collapse.  The gutter didn't show the collapse icon in the current block, or any parent block.

Restarting the IDE reverted to the normal behaviour (collapse all includes where the cursor is currently), so I assume it was a bug and not a feature.

0

Hi @Jayen! 

Please report it to a WebStorm support if the issue occurs again. 

Thanks! 

0

Please sign in to leave a comment.