pub struct Foo {
// shows all fields
// good, we like this
}
impl Foo {
fn func_1() {
// all lines f body
// we want this hidden
}
fn func_2() {
// all lines of body
// we want this hidden
}
}
What I want is to have only the top most level shown, i.e.
impl Foo {
fn func_1() { ... }
fn func_2() { ... }
}
``
A file may have morethan one impl blocks (for multiple traits). Is there a way to have it open just the top level for all the impl blocks ?
Thanks!
There's a "Code" -> "Folding" -> "Expand all to level" -> "1" action. By default, its keybinding isn't very convenient (ctrl+shift+numpad* -> 1) but you can re-bind it to something easier.
Short of writing a custom Java / Kotlin / Scala plugin, is there a way to bind this (expand to all level 1) event to get triggered every time a file is opened ?
I realize that seems like a lot, but it's a fast way to find a command if you don't use it all the time. FYI I'm on a mac and when I opened that "expand all to" menu, it had hotkeys listed for the individual levels.
As for running the command on file open, I don't know tha tthere's a way to do this, short of using a plugin.
Ah, the reason I mentioned "ExpandAllToLevel1" is that to bind it to a vim normal key sequence in ~/.ideavimrc, we need the exact name of the action. This way, inside a buffer, I can hit something like <esc> (goes to normal mode) then the desired key binding, and it executes the cmd.