-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Code is formatted using dprint, however dprint does not support C++. Instead it can call out to external processes to do the formatting. In this case, it seems the tool of choice is clang-format.
NOTE: This issue should be completed using upcoming Clang 22 release. The current Clang 21 does not do a good job formatting C++ features such as lambdas. Clang 22 is slated to be release Feb 24, 2026.
There are two maintained npm packages that distribute clang-format:
- https://www.npmjs.com/package/clang-format-node
- https://www.npmjs.com/package/@wasm-fmt/clang-format
The former bundles the compiled binaries for each platform. The later compiles clang-format and distributes as wasm. Both offer very similar performance. It's a matter of picking a horse.
In dprint.json, enable the exec configuration:
"exec": {
"cwd": "${configDir}",
"commands": [
{
"command": "pnpm clang-format-node -- -i {{file_path}}",
"exts": ["cpp", "cc", "cxx", "h", "hpp"]
}
]
},
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request