【发布时间】:2013-04-18 06:34:14
【问题描述】:
问题一:IntelliJ可以设置成换行自动缩进代码体吗?
这是我的意思的一个例子:
我有这个方法:
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 new line aligns itself with the preceding line
}
我无法在“设置”下的任何位置找到一个选项,该选项会使其成为默认行为。它存在吗?我想念它还是在寻找独角兽?
问题 2:是否可以选择让代码体默认缩进?如果有,在哪里可以找到?
例子:
使用“重新格式化代码...”命令后,我得到了这个:
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
}
这是我在“设置”选项中似乎找不到的另一件事。
任何帮助都会很棒。感谢您的宝贵时间。
【问题讨论】:
标签: java intellij-idea ide indentation