Java 插入符号在 IntelliJ 中无法正确转到下一行

Java caret not going to the next line correctly in IntelliJ

当我在 Java 中编写 Switch 语句时(我使用 IntelliJ IDEA),闪烁的光标或插入符号没有正确转到下一行。这不是一个大问题,只是一个烦恼,我不知道如何解决。

当我为 switch 代码块编写案例时:

switch(switchValue){
    case 1:
        System.out.println("Value was 1");
        break;
}

在'break;'之后,当我输入光标时,光标停留在case 1代码块内

switch(switchValue){
    case 1:
        System.out.println("Value was 1");
        break;
        <-- The cursor goes here
}

当我退格将其移回以便我可以创建一个新案例时,该行将返回到中断的末尾;

switch(switchValue){
    case 1:
        System.out.println("Value was 1");
        break;<-- cursor goes here
}

我可以移动它来创建新案例 2 的唯一方法是在我按回车键后手动使用我的方向键 4 个空格。是否有键盘快捷键可以让我无需额外步骤即可创建新案例?

switch(switchValue){
    case 1:
        System.out.println("Value was 1");
        break;
    <-- cursor goes here and after I use the directional keys    
    case 2:
        System.out.println("Value was 2");
        break;
}

这是一个非常晦涩的小问题,我似乎找不到答案。

我想我在发布问题后解决了自己的问题。

如果我在“break;”后转到下一行后只键入“case 2:”,IntelliJ IDEA 会自动格式化 case 并将其移动到正确的位置,没有任何麻烦。

switch(switchValue){
    case 1:
        System.out.println("Value was 1");
        break;
        case 2:
}

当您用冒号结束 case 语句时,编辑器会自动格式化该行并将语句移动到正确的位置。

switch(switchValue){
    case 1:
        System.out.println("Value was 1");
        break;
    case 2:
}