如何为 Intellij IDEA 启用自动格式化代码? [英] How enable auto-format code for Intellij IDEA?

查看:49
本文介绍了如何为 Intellij IDEA 启用自动格式化代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Intellij IDEA中输入';'后是否可以或按 'Enter' 发生此字符串的格式化?

Is it possible in Intellij IDEA after typing ';' or press 'Enter' happened formatting of this string?

例如,到:

a+b=10;

之后:

a + b = 10;

或者只有可能的选项:代码 > 重新格式化代码...?

Or only possible option: Code > Reformat Code...?

谢谢!

推荐答案

Intellij IDEA 中的格式化快捷键是:

The formatting shortcuts in Intellij IDEA are :

  • 对于 Windows:Ctrl + Alt + L
  • 对于 Ubuntu:Ctrl + Alt + Windows + L
  • 对于 Mac:⌥(选项) + ⌘(命令) + L
  • For Windows : Ctrl + Alt + L
  • For Ubuntu : Ctrl + Alt + Windows + L
  • For Mac : ⌥ (Option) + ⌘ (Command) + L

这篇关于如何为 Intellij IDEA 启用自动格式化代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆