llvm-project/clang/docs
mydeveloperday 8b7881a084 [clang-format] Add basic support for formatting JSON
I find as I develop I'm moving between many different languages C++,C#,JavaScript all the time. As I move between the file types I like to keep `clang-format` as my formatting tool of choice. (hence why I initially added C# support  in {D58404}) I know those other languages have their own tools but I have to learn them all, and I have to work out how to configure them, and they may or may not have integration into my IDE or my source code integration.

I am increasingly finding that I'm editing additional JSON files as part of my daily work and my editor and git commit hooks are just not setup to go and run [[ https://stedolan.github.io/jq/ | jq ]], So I tend to go to  [[ https://jsonformatter.curiousconcept.com/ | JSON Formatter ]] and copy and paste back and forth. To get nicely formatted JSON. This is a painful process and I'd like a new one that causes me much less friction.

This has come up from time to time:

{D10543}
https://stackoverflow.com/questions/35856565/clang-format-a-json-file
https://bugs.llvm.org/show_bug.cgi?id=18699

I would like to stop having to do that and have formatting JSON as a first class clang-format support `Language` (even if it has minimal style settings at present).

This revision adds support for formatting JSON using the inbuilt JSON serialization library of LLVM, With limited control at present only over the indentation level

This adds an additional Language into the .clang-format file to separate the settings from your other supported languages.

Reviewed By: HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D93528
2021-06-26 15:20:17 +01:00
..
CommandGuide [clang][docs] Fix documentation of -O 2020-09-17 13:44:01 +01:00
analyzer [analyzer] DynamicSize: Debug facility 2021-04-05 19:17:52 +02:00
tools [ASTMatchers] Make Param functors variadic 2021-03-03 11:41:20 +00:00
APINotes.rst docs: add documentation describing API Notes 2020-10-05 18:29:13 +00:00
AddressSanitizer.rst [clang] accept -fsanitize-ignorelist= in addition to -fsanitize-blacklist= 2021-05-04 10:24:00 -04:00
AutomaticReferenceCounting.rst [clang] Fix typos in documentation (NFC) 2021-03-06 15:52:52 -08:00
Block-ABI-Apple.rst Fix the type of the invoke function in the block ABI documentation 2020-09-04 10:29:09 -07:00
Block-ABI-Apple.txt
BlockLanguageSpec.rst
CMakeLists.txt fix comment typo to cycle bots 2020-04-06 18:58:27 -04:00
ClangCheck.rst
ClangCommandLineReference.rst [Driver] Delete -fsanitize-coverage-blocklist= in favor of -fsanitize-coverage-ignorelist= 2021-06-15 20:32:24 -07:00
ClangFormat.rst [clang-format] Add basic support for formatting JSON 2021-06-26 15:20:17 +01:00
ClangFormatStyleOptions.rst [clang-format] Add basic support for formatting JSON 2021-06-26 15:20:17 +01:00
ClangFormattedStatus.rst [clang-format] NFC, 2% improvement in overall clang-formatted status (now 50%) 2021-06-04 15:02:44 +01:00
ClangOffloadBundler.rst [Clang][Docs] Fix ambiguity in clang-offload-bundler docs 2021-01-11 17:23:24 +00:00
ClangPlugins.rst [Branch-Rename] Fix some links 2021-02-01 16:43:21 +05:30
ClangStaticAnalyzer.rst
ClangTools.rst [Branch-Rename] Fix some links 2021-02-01 16:43:21 +05:30
ConstantInterpreter.rst [docs] Fix warnings in ConstantInterpreter 2020-05-23 19:36:05 +00:00
ControlFlowIntegrity.rst [clang] accept -fsanitize-ignorelist= in addition to -fsanitize-blacklist= 2021-05-04 10:24:00 -04:00
ControlFlowIntegrityDesign.rst [clang] Fix typos in documentation (NFC) 2021-03-06 15:52:52 -08:00
CrossCompilation.rst
DataFlowSanitizer.rst [dfsan] Add full fast8 support 2021-06-07 17:20:54 -07:00
DataFlowSanitizerDesign.rst [DFSan] Change shadow and origin memory layouts to match MSan. 2021-06-25 17:00:38 -07:00
DriverArchitecture.png
DriverInternals.rst
ExternalClangExamples.rst
FAQ.rst
HardwareAssistedAddressSanitizerDesign.rst [HWASan] Mention x86_64 aliasing mode in design doc. 2021-03-25 14:22:20 -07:00
HowToSetupToolingForLLVM.rst Don't call anyone lazy in the documentation. 2020-03-17 16:33:28 -04:00
InternalsManual.rst Fix a typo in the internals manual 2021-06-08 12:32:56 -04:00
IntroductionToTheClangAST.rst
ItaniumMangleAbiTags.rst
JSONCompilationDatabase.rst [docs] Clarify compile_flags.txt subtleties 2021-01-31 11:16:59 +01:00
LTOVisibility.rst [Docs] Document --lto-whole-program-visibility 2020-08-25 19:44:54 -07:00
LanguageExtensions.rst [Docs] Minor fixes with language extension docs 2021-06-26 10:07:33 +01:00
LeakSanitizer.rst [lsan][docs] Clarify supported platforms 2021-04-21 10:27:55 -07:00
LibASTImporter.rst Doc: Links should use https 2020-03-22 22:49:33 +01:00
LibASTMatchers.rst
LibASTMatchersReference.html [ASTMatchers] Add forCallable(), a generalization of forFunction(). 2021-05-13 11:25:00 -07:00
LibASTMatchersTutorial.rst [clang-tooling] Prevent llvm::fatal_error on invalid CLI option 2021-01-29 10:15:06 +01:00
LibFormat.rst [clang-format][docfix] Update predefined styles in docs 2020-05-20 20:03:53 -04:00
LibTooling.rst [Branch-Rename] Fix some links 2021-02-01 16:43:21 +05:30
MSVCCompatibility.rst
Makefile.sphinx
MatrixTypes.rst [Matrix] Add missing newline to appease sphinx. 2021-03-12 09:33:36 +00:00
MemorySanitizer.rst [clang] accept -fsanitize-ignorelist= in addition to -fsanitize-blacklist= 2021-05-04 10:24:00 -04:00
Modules.rst Allow searching for prebuilt implicit modules. 2020-11-10 10:14:13 -08:00
ObjectiveCLiterals.rst
OpenCLSupport.rst Hopefully fix the Clang sphinx doc build. 2021-05-27 10:27:01 -04:00
OpenMPSupport.rst [OpenMP5][DOCS] Update status of masked construct and correct the color 2021-04-15 17:19:04 -05:00
PCHInternals.rst
PCHLayout.graffle
PCHLayout.png
RAVFrontendAction.rst [docs] Use make_unique in FrontendAction example 2021-04-20 13:47:16 -04:00
README.txt
RefactoringEngine.rst
ReleaseNotes.rst [clang-format] Add basic support for formatting JSON 2021-06-26 15:20:17 +01:00
SYCLSupport.rst [SYCL] Enable `opencl_global_[host,device]` attributes for SYCL 2021-05-18 10:27:35 +03:00
SafeStack.rst
SanitizerCoverage.rst [Driver] Delete -fsanitize-coverage-blocklist= in favor of -fsanitize-coverage-ignorelist= 2021-06-15 20:32:24 -07:00
SanitizerSpecialCaseList.rst [clang] accept -fsanitize-ignorelist= in addition to -fsanitize-blacklist= 2021-05-04 10:24:00 -04:00
SanitizerStats.rst
ShadowCallStack.rst
SourceBasedCodeCoverage.rst Coverage: Document how to collect a profile without a filesystem 2021-04-22 11:29:39 -07:00
ThinLTO.rst [docs] Try to make this bullet list in ThinLTO.rst actually be a bullet list 2020-11-24 14:08:42 +01:00
ThreadSafetyAnalysis.rst Thread safety analysis: Improve documentation for ASSERT_CAPABILITY 2020-09-26 22:16:50 +02:00
ThreadSanitizer.rst [clang] accept -fsanitize-ignorelist= in addition to -fsanitize-blacklist= 2021-05-04 10:24:00 -04:00
Toolchain.rst clang: libstdc++ LWM is 4.8.3 2021-04-22 05:26:07 -07:00
Tooling.rst
UndefinedBehaviorSanitizer.rst [clang] accept -fsanitize-ignorelist= in addition to -fsanitize-blacklist= 2021-05-04 10:24:00 -04:00
UsersManual.rst Revert "[clang][FPEnv] Clang floatng point model ffp-model=precise enables ffp-contract=on" 2021-06-19 08:01:22 -04:00
conf.py [docs] Bump the trunk major version to 13 and update copyright year. 2021-05-03 18:44:47 +02:00
doxygen-mainpage.dox
doxygen.cfg.in
index.rst [Doc] Add SYCLSupport.rst to index toctree. 2021-04-26 16:16:10 +03:00
make.bat

README.txt

See llvm/docs/README.txt