Intellij缩进格式-带/不带大括号的方法定义(在scala中)
我对intellij缩进有点小麻烦,希望有人能帮我解决 如果我使用大括号编写方法声明,缩进可以正常工作:Intellij缩进格式-带/不带大括号的方法定义(在scala中),scala,intellij-idea,auto-indent,Scala,Intellij Idea,Auto Indent,我对intellij缩进有点小麻烦,希望有人能帮我解决 如果我使用大括号编写方法声明,缩进可以正常工作: def function(a:A): B = { // When I hit return on this line... // the cursor goes here (4 spaces in) } 但是,如果不包括大括号,则不会得到任何缩进: def function(a:A): B = // When I hit return on this line... //
def function(a:A): B = { // When I hit return on this line...
// the cursor goes here (4 spaces in)
}
但是,如果不包括大括号,则不会得到任何缩进:
def function(a:A): B = // When I hit return on this line...
// the cursor goes here (0 spaces in)
更奇怪的是,如果在返回之前我在第一行已经有了一些代码,我会得到正确的间距
之前:
def function(a:A): B = some.code.here //cursor is immediately after the = sign
之后:
def function(a:A): B =
some.code.here // Correct indentation behavior.
所以我想知道的是:如果我在方法声明的末尾点击return,而光标后面没有任何代码,是否有一个设置会导致自动缩进
谢谢 转到文件>设置>编辑器>要自定义的代码样式it@Zar为了改变这种行为,需要在那里更改哪个特定设置?@sepp2k抱歉,但我不知道,我没有使用Scala。我不确定这个设置是否存在,但如果存在,它就会存在。我没有发布答案,因为我实际上没有检查这个特定的设置。你有没有发现如何解决这个问题?