Java 我可以将IntelliJ设置为自动缩进代码体吗?
问题1:IntelliJ是否可以设置为在生成新行时自动缩进代码体 以下是我的意思的一个例子: 我有这个方法:Java 我可以将IntelliJ设置为自动缩进代码体吗?,java,intellij-idea,ide,indentation,Java,Intellij Idea,Ide,Indentation,问题1:IntelliJ是否可以设置为在生成新行时自动缩进代码体 以下是我的意思的一个例子: 我有这个方法: public static void main(String[] args) { System.out.println("Hi there."); } 在键入表达式后按回车键时,我得到以下结果: public static void main(String[] args) {
public static void main(String[] args)
{
System.out.println("Hi there.");
}
在键入表达式后按回车键时,我得到以下结果:
public static void main(String[] args)
{
System.out.println("Hi there.");
// the new line aligns itself with the braces.
}
public static void main(String[] args)
{
System.out.println("Hi there.");
// the code body is realigned with the braces
}
我希望它能做到这一点:
public static void main(String[] args)
{
System.out.println("Hi there.");
// the new line aligns itself with the preceding line
}
我无法在设置下的任何位置找到使其成为默认行为的选项。它是否存在,我是否错过了它,还是我在寻找一只独角兽
问题2:是否有默认缩进代码体的选项?如果有,在哪里可以找到
例如:
使用“重新格式化代码…”命令后,我得到以下结果:
public static void main(String[] args)
{
System.out.println("Hi there.");
// the new line aligns itself with the braces.
}
public static void main(String[] args)
{
System.out.println("Hi there.");
// the code body is realigned with the braces
}
是否可以将IntelliJ设置为执行此操作,如果可以,我在哪里可以找到该选项
public static void main(String[] args)
{
System.out.println("Hi there.");
// the code body is indented from the braces
}
这是另一件我在设置选项中找不到的事情
任何帮助都会很好。谢谢您的时间。您应该使用
下一行的每个移位的选项:
智能创意15
文件>设置…>编辑器>代码样式>Java>包装和大括号>大括号放置>在方法声明中>下一行,每一行都已移位