We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
As described in the official doc (Link), setting AlignArrayOfStructures to Left should result in:
AlignArrayOfStructures
Left
struct test demo[] = { {56, 23, "hello"}, {-1, 93463, "world"}, {7, 5, "!!" } };
However, when using the build-in clang-format functionality in clangd version 18.1.2
Output of clangd --version: clangd version 18.1.2 Features: windows Platform: x86_64-pc-windows-msvc
Output of clangd --version:
clangd --version
clangd version 18.1.2 Features: windows Platform: x86_64-pc-windows-msvc
it results in the following:
struct Test { int a, b; const char* c; }; std::vector<Test> demo = { {56, 23, "hello"}, {-1, 93463, "world"}, {7, 5, "!!" } };
Which is OBVIOUSLY unexpected.
Trying with other arrays also results in similar outputs:
struct Vertex { glm::vec3 color; glm::vec2 pos; }; inline const std::vector<Vertex> vertex_list = { {{1.0f, 0.0f, 0.0f}, {0.0f, -0.5f}}, {{0.0f, 1.0f, 0.0f}, {0.5f, 0.5f} }, {{0.0f, 0.0f, 1.0f}, {-0.5f, 0.5f}} };
Notice the fifth floating point numbers are not aligned
The .clang-format config I'm currently using:
.clang-format
BasedOnStyle: Microsoft IndentWidth: 4 ColumnLimit: 100 SpacesBeforeTrailingComments: 2 # Allows AllowShortFunctionsOnASingleLine: Inline AllowShortIfStatementsOnASingleLine: true AllowShortLoopsOnASingleLine: true AllowShortBlocksOnASingleLine: Empty AllowShortLambdasOnASingleLine: false # Line breaks BreakBeforeBinaryOperators: All BreakConstructorInitializers: AfterColon BreakBeforeBraces: Allman # BracedInitializerIndentWidth: 4 # Bin-packs BinPackArguments: false BinPackParameters: false PackConstructorInitializers: Never AlwaysBreakTemplateDeclarations: Yes ExperimentalAutoDetectBinPacking: false # Alignments AlignConsecutiveBitFields: true AlignConsecutiveAssignments: true AlignArrayOfStructures: Left AlignConsecutiveDeclarations: true PointerAlignment: Left AlignOperands: AlignAfterOperator AlignAfterOpenBracket: BlockIndent BraceWrapping: SplitEmptyFunction: false SplitEmptyRecord: false SplitEmptyNamespace: false BeforeLambdaBody: true ContinuationIndentWidth: 4 Cpp11BracedListStyle: true EmptyLineAfterAccessModifier: Never EmptyLineBeforeAccessModifier: Always UseTab: Always FixNamespaceComments: false NamespaceIndentation: All
The clangd binary is from the offical LLVM release 18.1.2, downloaded from Github. I didn't compile the binary by myself.
The text was updated successfully, but these errors were encountered:
Under some further testing, settings UseTab to Always is causing part of the problem.
UseTab
Always
UseTab: Always
UseTab: AlignWithSpaces
However the alignment of another example isn't resolved by changing the UseTab attribute: With UseTab: Always:
With UseTab: AlignWithSpaces:
Sorry, something went wrong.
No branches or pull requests
As described in the official doc (Link), setting
AlignArrayOfStructures
toLeft
should result in:However, when using the build-in clang-format functionality in clangd version 18.1.2
it results in the following:
Which is OBVIOUSLY unexpected.
Trying with other arrays also results in similar outputs:
Notice the fifth floating point numbers are not aligned
The
.clang-format
config I'm currently using:Note
The clangd binary is from the offical LLVM release 18.1.2, downloaded from Github. I didn't compile the binary by myself.
The text was updated successfully, but these errors were encountered: