【问题标题】:How to auto add the parentheses after if/for/while in CLion?如何在 CLion 中的 if/for/while 之后自动添加括号?
【发布时间】:2018-03-26 03:39:08
【问题描述】:

当我使用IDEA时,输入if/for/while,括号会自动添加,但CLion不会自动补全。

想法

克利翁

如何解决这个问题?

【问题讨论】:

  • 我希望 Clion 在输入 if 时自动添加括号。

标签: intellij-idea clion jetbrains-ide


【解决方案1】:

您需要使用完整的语句(Ctrl+Shift+Enter)。

void foo() {
  if|<Ctrl+Shift+Enter>
}

生成

void foo() {
  if (true|<Ctrl+Shift+Enter>) {
  }
}

一个完整的移动你进入块:

void foo() {
  if (true) {
    |
  }
}

【讨论】:

【解决方案2】:

可以在 Settings/Editor/General/Smart Keys 中找到(或者直接去 Help-> Find -> Smart Keys)

您可以选择检查HomeEnd (on blank line)Insert pair bracket 等。检查Insert pair bracket。这应该这样做。

【讨论】:

    猜你喜欢
    • 2021-03-15
    • 1970-01-01
    • 2015-02-10
    • 1970-01-01
    • 2011-04-11
    • 2012-02-02
    • 1970-01-01
    相关资源
    最近更新 更多