You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

IntelliJ IDEA社区版2019.2:Scala格式化调整case class位置

Fixing Scala Formatting Order in IntelliJ IDEA 2019.2 Community

Hey there! I’ve run into this exact issue before, so let me walk you through how to tweak the settings to get your desired code order:

  • First, open up the Settings panel. You can use the shortcut Ctrl+Alt+S (Windows/Linux) or Cmd+, (Mac), or go to File > Settings from the top menu.
  • Navigate to Editor > Code Style > Scala in the left sidebar.
  • Switch to the Arrangement tab—this is where all the code sorting rules live.
  • Look at the Rules list on the right. You’ll see entries for different code elements like type definitions, methods, case classes, etc.
  • Find the rule for Case classes and use the up/down arrow buttons on the right side of the list to move it above the Methods rule. Make sure Type definitions stays at the top.
  • Hit Apply then OK to save your changes.

Now when you use your formatting shortcut (default is Ctrl+Alt+L), your code should be ordered as: type definitions → case classes → functions, just like you wanted!

内容的提问来源于stack exchange,提问作者mjbsgll

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 08:33:09