clang-format AlignAfterOpenBracket and ColumnLimit not applied correctly?



Im my c++ project I have a .clang-format-file with "ColumnLimit=0" and "AlignAfterOpenBracket=DontAlign". When formatting my files with VS clang-format support and ReSharper enabled, I'm seeing that ReSharper is still applying these two settings:

  • align multiline construct->function parameters
  • line breaks and wrapping->line wrapping->hard wrap at

This causes function definitions to be line breaked at 120 columns, indented with spaces, although the style file says tabs, and also to be indented to match the opening parenthesis, which "DontAlign" is supposed to disable.

Are these settings not supposed to be overridden by clang-format? I see



I'm also seeing that ReSharper is referencing a "BasedOnStyle: llvm" even though I've tried to disable this in many ways. Is this expected?



Is there anything extra I should do to ensure that a .clang-format file is adhered to strictly?

Comment actions Permalink

Hello Mittspamkonto!

It seems that clang-format support is disabled in your settings. Please check ReSharper | Options | Code Editing | General Formatter Style | Read code style from .clang-format files.

As for your question about "BasedOnStyle: LLVM": clang-format uses default values from LLVM style for any formatting option that is not specified explicitly in .clang-format file. ReSharper reproduces this behaviour and shows these default options in "BasedOnStyle: LLVM" section.

Comment actions Permalink

Thank you Vasiliy. That clears things up. I disabled it since I was under the impression that it would conflict with the VS clang-format support. If you don't mind, could you quickly explain what the interaction is between VS formatting, ReSharper formatting, VS clang-format support and ReSharper clang-format support?

Comment actions Permalink

You are welcome!


Basically, VS and ReSharper act independently here. ReSharper uses its own "Reformat code" action, which uses ReSharper formatting options. These options can be overriden by .clang-format.


Visual Studio formats code either with its own formatter, or by calling clang-format.exe (if clang-format support is enabled in VS settings).


Settings for indent size and style can be shared between ReSharper and VS: see ReSharper options Code Editing | C++ | Formatting Style | Tabs and Indents | Use indent style and size from Visual Studio (enabled by default) and Code Editing | General Formatter Style | Provide ReSharper indent settings to Visual Studio (disabled by default).

Comment actions Permalink

Hello again! I tried to make sense of what was happening, because I still couldn't get things to work properly. In the end I concluded that I was also experiencing, which threw me off a bit.

I also found that ReSharper C++ formatted the file after using the standard VS 'Ctrl+K, Ctrl+D' to format. Is that expected? If the two formatters are independent, I wouldn't have expected ReSharper to kick in at that time.

Comment actions Permalink

Hello! Have you tried 2020.3 EAP 4, where the issue RSRP-481108 is fixed?

Are you sure that the file is formatted by ReSharper and not by VS? This is not an expected behaviour, ReSharper formatter shouldn't be called by 'Ctrl+K, Ctrl+D' unless you specified this shortcut in ReSharper settings, see


Please sign in to leave a comment.