Clang Config Editor
A VS Code extension that opens .clang-format, _clang-format, .clangd and .clang-tidy in a form-based editor.
Features
- One control per option: dropdowns for enums and booleans, number and text inputs, and a YAML/JSON field for lists and maps.
- Option names, descriptions and allowed values come from the SchemaStore schemas in
schemas/.
- Search box and an "Only set" filter. The
× button removes a key from the file.
- For
.clang-format: unset options show the default value of the BasedOnStyle style, and a side panel formats sample C++ code with the current config. The sample is editable.
- Edits go to the text document, so undo, save and comments work as normal. "Open as Text" switches to the plain text editor.
- Commands to create a config file in the workspace root: Clang Config: Create .clang-format, Create .clangd, Create .clang-tidy. They are also in the Explorer context menu on the root folder.
Requirements
clang-format on the PATH for the preview and defaults. Set clangConfigEditor.clangFormatPath to use another binary.
Limits
- Files with several YAML documents (
---): only the first document is shown and edited.
- The preview uses the options in the file only.
BasedOnStyle: InheritParentConfig is not resolved.
- The clang-format schema is for clang-format 21. Options newer than your clang-format binary make the preview report an error.
License
MIT. Bundled third-party material is listed in THIRD_PARTY_NOTICES.md.
This extension is not affiliated with or endorsed by the LLVM project. Clang and LLVM are names of the LLVM Foundation.
Development
npm install
npm run build
npm test
Press F5 in VS Code to start an Extension Development Host with test-fixtures/ open. npm run package builds a minified .vsix. npm run fetch-schemas downloads the latest schemas.
Releasing
Publishing runs in GitHub Actions (.github/workflows/publish.yml) with Marketplace Trusted Publishing, so no token is stored.
One-time setup: on the diegotek publisher's Trusted Publishing page, add a policy with owner DCubix, repository clang-format-editor-vscode, workflow publish.yml, environment marketplace.
For each release:
- Set
version in package.json and add a CHANGELOG.md entry. Commit and push.
- Tag and push the tag. The tag must be
v + the package.json version:
git tag v0.1.0
git push origin v0.1.0
The workflow runs the tests, packages the .vsix, publishes it, and uploads the .vsix as a build artifact.
The icon source is images/icon.svg. Regenerate the PNG with:
rsvg-convert -w 256 -h 256 images/icon.svg -o images/icon.png