Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Intellij缩进格式-带/不带大括号的方法定义(在scala中)_Scala_Intellij Idea_Auto Indent - Fatal编程技术网

Intellij缩进格式-带/不带大括号的方法定义(在scala中)

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... //

我对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...
//  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。我不确定这个设置是否存在,但如果存在,它就会存在。我没有发布答案,因为我实际上没有检查这个特定的设置。你有没有发现如何解决这个问题?