CLion 2025.2 Help

展开并移除语句

对于 C++,此重构可以安全地展开 if...elseforwhiledo...whiletry...catch 控制语句,或准确移除嵌套语句的封闭部分。

除了 C++, 解包/移除 操作还适用于:

展开或移除语句

  1. 将插入符号放在您想要展开或移除的表达式上。

  2. 从主菜单中选择 代码 | 解包/移除 或按 Ctrl+Shift+Delete。 CLion 会显示一个弹出窗口,其中包含当前上下文中可用的所有操作。 展开后保留的语句显示在蓝色背景上,移除的语句显示在灰色背景上。

  3. 点击所需的操作,或使用上下箭头键选择并按下 Enter

展示不同语言中语句展开的示例:

展开语句示例

之前

之后

@implementation SClass - (int)sqrV { if (v != 0) return v * v; else // this 'else' statement will be removed return 0; } @end
@implementation SClass - (int)sqrV { if (v != 0) return v * v; } @end

之前

之后

count = 0 # This 'while' statement will be unwrapped while True: print(count) count += 1 if count >= 5: break
count = 0 print(count) count += 1 if count >= 5: break

之前

之后

function GetCookie (name) { var arg = name + "="; var alen = arg.length; var i = 0; // This 'while' statement will be unwrapped while (i != document.cookie.length) { var j = i + document.cookie.length; i++; } }
function GetCookie (name) { var arg = name + "="; var alen = arg.length; var i = 0; var j = i + document.cookie.length; i++; }
最后修改日期: 2025年 9月 26日