【发布时间】:2018-10-16 15:53:00
【问题描述】:
CLion 中发生了一些奇怪的自动缩进,我不明白为什么。这是一个例子
int i1(5); // some comments, then I hit Enter
// auto indentation goes here. I hit Enter again
// It goes here
float f = 5; // some comments, then I hit Enter
// then auto indentation goes here. I hit Enter again
// It then goes here.
float f2 = 6;
// If I don't comment on the previous line, there is no weird indentation
似乎每当我使用 = 来初始化一个变量,然后在行尾添加注释时,它都会在下一行给我额外的缩进。但在所有其他情况下,它不会给我额外的缩进。
我最近安装了 CLion,它使用的是默认代码样式。似乎额外的缩进是由连续缩进设置控制的,但我只希望这个连续缩进设置应用于代码,而不是 cmets。使用 = 赋值时,在哪里可以更改我的设置以禁用注释的继续缩进?
【问题讨论】:
-
clion不是用clang-format吗?还是只有在您键入时才会出现这种缩进?
-
如果您在菜单中四处看看,找到代码风格的设置应该不会那么难。至于缩进本身,这似乎是一个可能的错误,应该报告给the CLion issue tracker。
-
@VTT 额外的缩进仅在我输入时发生。当我选择该块并再次单击自动缩进行时,CLion 实际上知道额外的缩进不正确并将其删除。
-
我将在下一个 CLion 2018.2 EAP 中修复。
标签: c++ ide clion jetbrains-ide