Reputation: 359
I'm the kind of person who would systematically go through every single option available to toggle, and this time it's with clang-format
in VSCode. I found this, which I'm assuming lists every single thing available to cram into a .clang-format
file for VSCode to use. Unfortunately, VSCode seems to not recognize a handful of them:
BitFieldColonSpacing
BreakBeforeConceptDeclarations
EmptyLineBeforeAccessModifier
IndentAccessModifier
IndentRequires
SortIncludes
SpaceAroundPointerQualifiers
SpaceBeforeCaseColon
Out of the handful of options that VSCode fails to load, only SortIncludes
is recognized at all, but it only accepts a bool, not the options that the reference says are available. The rest of the options are outright not recognized:
YAML:xxx:xxx: error: unknown key 'xxx'
Error reading /path/to/.clang-format: Invalid argument
Could I be missing something, or does VSCode not support those options? I'm using the C/C++ extension by Microsoft, using VSCode on Linux.
Thank you for your time.
Upvotes: 2
Views: 6404
Reputation: 661
Quickish answer: This is not a bug. At least some of those options (IndentAccessModifiers) are still in the "Work In Progress" clang 13. You would need to (download and) replace the underlying clang-format binary in order to use these new features.
For whatever reason, the clang-format page describing the various options defaults to showing you everything in version 13, but does not actually warn you that these are not official release versions. Nor does it at least tell you what version a feature was introduced. It's not until you do a little digging that you find out that the main documentation page is not what you want. The most recent VSCode uses version 11.1.0, and you can find the matching options here: ClangFormatStyleOptions version 11.1.0
FUTURE NOTE: This answer mostly only applies today May 27, 2021. This may not apply 6 years down the line and VS Code is now at version 22 of clang. That said, you may find this useful if you come across this same type of issue in version discrepancy.
Upvotes: 4