clang format export not respecting settings?
I created a C++ code formatting style I use with my unreal engine project.
I use the “Write current style to .clang format” and set it to use Rider Formatter and Read Code Style from .clang-format files.

However it then says there are things in the Clang Format that are overriding the settings. If I uncheck the read code style from .clang format files option, my settings work. Could it be that the .clang-format file export isn't working right, or are the settings I want not possible to store in a .clang-format file? I'd want to export these settings and save them to share with the team and restore them when needed. I don't see other export formats. This ends up as a file I can commit to our git repo which is nice, once I get it working.

I also verified the clang-format file it's trying to use is the correct one I just exported by using this. https://www.jetbrains.com/help/rider/Configure_Code_Formatting_Rules.html#troubleshoot-formatting-settings
I didn't exactly read through the format file in detail either to find whether or not my settings exported out correctly since it's a gigantic file and I'm not familiar with this format.
Please sign in to leave a comment.
Hello Ilya,
Thank you for contacting Rider support.
The yellow bar with a message means, that the code style settings from .clang-format are red and values there intersects with those you can see in Rider UI. The settings from .clang-format file takes priority over Riders own settings, so that, such a settings are marked in yellow.
Would you mind sharing additional information as described below, so that I can take a closer look at the issue?
Have a nice day!
Not sure if there's a way to attach files, so here are the contents of the .clang-format file and a link to the layer files. https://github.com/ill/FileShare/blob/main/SettingsLayers.zip
I have the files for the exported DotSettings layers but I'm not sure how to attach them in this forum.
Sample settings that don't work are spacing before pointer and after pointer. I have it set so it should look like this:
Type* VarName;
But it does this based on the clang-format file.
Type *VarName;
---Language: CppBasedOnStyle: LLVMAccessModifierOffset: -4AlignAfterOpenBracket: DontAlignAlignConsecutiveAssignments: falseAlignConsecutiveDeclarations: falseAlignOperands: falseAlignTrailingComments: falseAllowShortIfStatementsOnASingleLine: falseAlwaysBreakAfterDefinitionReturnType: falseAlwaysBreakTemplateDeclarations: YesBinPackArguments: falseBinPackParameters: falseBraceWrapping:AfterCaseLabel: trueAfterClass: trueAfterControlStatement: trueAfterEnum: trueAfterFunction: trueAfterNamespace: trueAfterStruct: trueAfterUnion: trueAfterExternBlock: falseBeforeCatch: trueBeforeElse: trueBeforeLambdaBody: trueBeforeWhile: trueSplitEmptyFunction: trueSplitEmptyRecord: trueSplitEmptyNamespace: trueBreakBeforeBraces: CustomBreakConstructorInitializersBeforeComma: falseColumnLimit: 0ConstructorInitializerAllOnOneLineOrOnePerLine: trueIncludeCategories:- Regex: '^<.*'Priority: 1- Regex: '^".*'Priority: 2- Regex: '.*'Priority: 3IncludeIsMainRegex: '([-_](test|unittest))?$'IndentCaseBlocks: trueIndentWidth: 4InsertNewlineAtEOF: trueMacroBlockBegin: ''MacroBlockEnd: ''MaxEmptyLinesToKeep: 2SpaceInEmptyParentheses: falseSpacesInAngles: falseSpacesInConditionalStatement: falseSpacesInCStyleCastParentheses: falseSpacesInParentheses: falseTabWidth: 4UseTab: Always...Hello Ilya,
Thank you for the details shared.
The LLVM style you use in clang-format predefines the
PointerAlignment: Rightrule. If there is noPointerAlignment: Left(or Middle) explicitly specified in the config file, the alignment to Right is used. Since clang-format formatting settings have higher priority over Rider's own settings, the alignment to the right is used in this case.As I understand, the problem occurred in this scenario:
Type* VarName. Reformatting works as expected until you export settings to .clang-format;Type *VarName.I registered this issue on our tracker: RSCPP-36053 PointerAlignment is not exported to .clang-format.
To workaround it, please add
PointerAlignment: Leftmanually to the .clang-format file.Hope that helps.
If there is anything else I can assist you with, please tell me.
Have a nice day!