Skip to content

Formatting ​

Formatting a Document ​

Formatting a file (textDocument/formatting) lays it out in its clang-format style and sorts its includes in the same pass.

Supported

Format a document

Formatting a file lays all of it out in the style its .clang-format asks for

Supported

Includes sorted

Formatting also sorts each block of includes, as the style asks

Formatting a Selection ​

Range formatting (textDocument/rangeFormatting) reformats only the lines a selection touches.

Supported

Format a selection

Formatting a selection reformats only the lines it touches

Style Resolution ​

Each file takes the style of the .clang-format nearest above it, as clang-format finds it.

Supported

Nearest style file

Each file takes the style of the .clang-format nearest above it

A file with no .clang-format above it takes the LLVM style.

Project-wide Format ​

Beyond the LSP textDocument/formatting request (which formats a single open file), clice provides project-wide formatting via CLI: clice format formats the build's files, several at a time, and --check reports what it would change.