How to auto indent a C++ class with 4 spaces using clang-format?

As near as I can tell, clang-format offers no option for indenting function contents differently from non-access-modifier class contents. That is, consider the following code: class A { public: void foo() {} } void bar() { int a; } In this code, the line “void foo() {}” will always be indented the same amount as … Read more

How to fix the YAML syntax error: did not find expected ‘-‘ indicator while parsing a block?

You don’t have 32 lines in your file (probably because you stripped non-essential data out of the example), but the indentation level points to the line with fi. Actually the problem starts earlier and what you want to do is specify the action to take as a multi-line string. You can specify those in YAML … Read more

Code-style for indention of multi-line ‘if’ statement? [duplicate]

Often I work around this problem by calculating the condition in an own statement: condition = (collResv.repeatability is None or collResv.somethingElse) if condition: collResv.rejected = True collResv.rejectCompletely() Though, for a still relatively short condition as in your specific example I’d go for nosklo‘s solution – the extra statement used here is more suited for even … Read more

Shortcut for changing tabs->spaces->tabs in IntelliJ IDEA

To toggle between tabs and spaces: On the main menu, choose Edit → Convert Indents, and then choose To Spaces or To Tabs respectively. Read more about Changing Indentation. You can quickly do the same with Navigating to Action menu by pressing Ctrl+Shift+A and type convert indents in the field: If you want to set … Read more