I have seen this blog: Custom code folding regions in IntelliJ
But it's useful for Java, it doesn't work on Scala.
Expand or collapse code elements To collapse or expand all code fragments, press Ctrl+Shift+NumPad - / Ctrl+Shift+NumPad + . IntelliJ IDEA collapses or expands all fragments within the selection, or, if nothing is selected, all fragments in the current file, for example, all methods in a file.
To start working with Scala in IntelliJ IDEA you need to download and enable the Scala plugin. If you run IntelliJ IDEA for the first time, you can install the Scala plugin when IntelliJ IDEA suggests downloading featured plugins. Otherwise, you can use the Settings | Plugins page for the installation.
On the Project pane on the left, right-click src and select New => Scala class. If you don't see Scala class, right-click on HelloWorld and click on Add Framework Support…, select Scala and proceed. If you see Error: library is not specified, you can either click download button, or select the library path manually.
In the editor, type a name of a new code element and press Alt+Enter. From the list of intentions, select the one you need. Press Enter. IntelliJ IDEA lets you convert Java code into Scala. Copy your Java code (expression, method, class) and paste it into a Scala file.
Now, when you select the Custom folding regions option, IntelliJ IDEA will fold such regions when you open your file in the editor. JavaScript - language-specific code fragments in JavaScript and TypeScript
IntelliJ IDEA lets you use different Scala intention actions, convert your code from Java to Scala, and use different Scala templates while working in the IntelliJ IDEA editor. You can add different intentions for strings, perform different actions, and set a different format for multi-line strings.
IntelliJ IDEA displays the list of available Live templates for Scala. Select the one you need and press Enter. You can also define a new template or edit the existing one.
To make that work what I do is add a new line after
//<editor-fold desc="Description">
and before too
//</editor-fold>
so it code will look like
//<editor-fold desc="Description">
def save() = {
//save
}
def findOne() = {
//fineOne
}
//</editor-fold>
If code folding is still not available you can delete >
from //<editor-fold desc="Description">
and add it again and it will work.
I think its a bug and that's the workaround that I'm doing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With