Can you set clang-format’s line length?
The configuration option responsible for it is called ColumnLimit. You can remove the column limit by setting it to 0. ColumnLimit: 0
The configuration option responsible for it is called ColumnLimit. You can remove the column limit by setting it to 0. ColumnLimit: 0
When you have a line that’s over the line length limit, clang-format will need to insert one or more breaks somewhere. You can think of penalties as a way of discouraging certain line-breaking behavior. For instance, say you have: Namespaces::Are::Pervasive::SomeReallyVerySuperDuperLongFunctionName(args); // and the column limit is here: ^ Clang-format will probably format to look a … Read more
As of version 6.0, the option IndentPPDirectives can be used. Usage is described in this review. Using IndentPPDirectives: None results in: #if FOO #if BAR #include <foo> #endif #endif While IndentPPDirectives: AfterHash gives: #if FOO # if BAR # include <foo> # endif #endif Edit: see @Gabriel Staples’ answer for details on the BeforeHash option … Read more
I think clang format was simply not designed for this. Rules are not things it applies incrementally, the program is instead built around, parsing your entire program and forgetting (most of) the old whitespace, and generating new whitespace based on the rules you select. You can see some overview of the architecture here: http://www.llvm.org/devmtg/2013-04/jasper-slides.pdf First … Read more
As the documentation says, invoke clang-format with -style=file, and use a .clang-format file placed in an enclosing directory to customize style options. The format style option specifying brace placement is called BreakBeforeBraces. From the docs, BreakBeforeBraces (BraceBreakingStyle) The brace breaking style to use. Possible values: BS_Attach (in configuration: Attach) Always attach braces to surrounding context. … Read more
Oftentimes, the following helps: Re-install Alcatraz, restart Xcode, de-install and re-install your plugin. Sometimes it helps to restart Xcode again. This worked for me. If your plugin still does not show up, the problem is probably that the the compatibility key of your new Xcode is not yet included in the list of compatibility keys … Read more
You can use External Tools in CLion. Go to File->Settings->Tools->External Tools and click on the plus sign. A window should pop up. Use a name of your choice. For the Tool settings tab I’m using this configuration: Program: clang-format-3.7 (you should use the name of your executable here) Parameters: -i $FileName$ Working directory: $FileDir$ Now, … Read more
As far as I can tell, there’s currently no way to force clang-format to insert blank lines between consecutive functions where there currently are none. IMHO this is a huge missing feature.
With Ubuntu 16.04, simply do: sudo apt install clang-format
I got confused by that too. When they tell you to use the flag -style=file they literally mean for you to type out -style=file, NOT -style=<path/to/actual/filename>. With this flag, clang-format will look for a file called .clang-format in the directory of the target file. If it doesn’t find any it will cd .. and try … Read more