Rust, IntelliJ, code folding across buffer open/closes

I am using IntelliJ + Rust plugin.

I'm staring to miss code folding (something like, say, https://vim.fandom.com/wiki/Folding )

I want the open/close to be manually toggled and to persist across buffer open/closes. This implies it needs to add/remove comments, which I'm okay with.

Does anyone have a working setup for this?

Works out of the box with region/endregion comments:

image

3 Likes
// this works:
// region ...
...
// endregion ...

// this does not work:
// asdf ...
...
// endasdf ...

Can you point me to where this is documented? I'm interested to see what other related features are.

Good question! I love IntelliJ, however I find it's documentation abundant but mostly useless for learning stuff. This behavior is mentioned in passing here https://www.jetbrains.com/help/idea/working-with-source-code.html#use-the-surround-with-action (TIL, there's "surround with" action for this), but I personally have learned about this when reading source code of IntelliJ itself...

1 Like

lol. This was my exact experience trying to write a custom plugin -- got no where with the documentation, did a git clone of the community edition src, and started grepping through it to understand the types.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.