docs: Improve formatter docs. Examples for C/C++ (#20553)

This commit is contained in:
Peter Tripp 2024-11-13 14:24:50 +00:00 committed by GitHub
parent 84e47fb80b
commit 3a319e6cbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 57 additions and 0 deletions

View file

@ -825,6 +825,8 @@ While other options may be changed at a runtime and should be placed under `sett
3. External formatters may optionally include a `{buffer_path}` placeholder which at runtime will include the path of the buffer being formatted. Formatters operate by receiving file content via standard input, reformatting it and then outputting it to standard output and so normally don't know the filename of what they are formatting. Tools like prettier support receiving the file path via a command line argument which can then used to impact formatting decisions.
WARNING: `{buffer_path}` should not be used to direct your formatter to read from a filename. Your formatter should only read from standard input and should not read or write files directly.
```json
"formatter": {
"external": {