RFC: Reusing .clang-format-ignore (original) (raw)

September 15, 2025, 6:01am 1

Hello all,

Add a setting to control whether formatting is applied to changes made by a code action · Issue #2476 · clangd/clangd · GitHub was logged by a user asking for clangd to selectively format. This is a feature that already exists in the clang-format executable and seems easily lifted from main function into the library.

When proposing this @HighCommander4 stated:

(Depending on the details, it may also need an RFC, e.g. if the proposal involves modifying the behaviour of existing libFormat APIs to start paying attention to .clang-format-ignore. If it just involves adding a new API for checking .clang-format-ignore and leaving it to consumers of libFormat to decide whether or not to use that, then no RFC is needed.)

I see a couple of possible ways to implement this:

For reference, a search on reformat( in the LLVM codebase give 28 files including documentation and tests.

My preference goes to the second option.

Logged this as an issue on the tracker: