简体   繁体   English

如何在intelliJ IDEA中为Scala自定义代码折叠?

[英]How to custom code folding for Scala in intelliJ IDEA?

I have seen this blog: Custom code folding regions in IntelliJ 我见过这个博客: IntelliJ中的自定义代码折叠区域

But it's useful for Java , it doesn't work on Scala . 但它对Java很有用,它对Scala不起作用。

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. 如果代码折叠还没有上市,你可以删除>//<editor-fold desc="Description">然后重新添加,它会工作。

I think its a bug and that's the workaround that I'm doing. 我认为这是一个错误,这就是我正在做的解决方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM