加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – 我可以将IntelliJ设置为自动缩进代码体吗?

发布时间:2020-12-14 06:08:56 所属栏目:Java 来源:网络整理
导读:问题1:IntelliJ可以设置为在创建新行时自动缩进代码体吗? 这是我的意思的一个例子: 我有这个方法: public static void main(String[] args) { System.out.println("Hi there."); } 在键入表达式后按下返回键,我得到: public static void main(String[]

问题1: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
        }

这是我在“设置”选项中似乎找不到的另一件事.

任何帮助都会很棒.谢谢你的时间.

最佳答案
您应该使用Next行,每个移位选项:

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读