简体   繁体   中英

Order Scala methods alphabetically (by name) using Intellij IDEA

我想按字母顺序排列 Scala 函数,我使用的是 Intellij IDEA 有没有办法做到这一点?

  1. Settings > Editor > Code Style > Scala > Arrangement
  2. In Matching Rules click + to add a new rule
  3. If you want to order def without modifiers (which is public by default) in Type click function and in Modifier click public , in Order choose order by name . Then click OK . 在此处输入图片说明
  4. After that you can open your file with unordered methods, click Code > Rearrange Code and they will be ordered by name.

PS I used IDEA Community Edition 2019.3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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