llvm-project/clang/tools
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
..
amdgpu-arch [amdgpu-arch] Guard hsa.h with __has_include 2021-05-10 07:33:30 +00:00
apinotes-test [Support] Don't include VirtualFileSystem.h in CommandLine.h 2021-04-21 10:19:01 -04:00
arcmt-test [NFC] Reordering parameters in getFile and getFileOrSTDIN 2021-03-25 09:47:49 -04:00
c-arcmt-test
c-index-test [index] Improve macro indexing support 2021-04-06 09:12:14 -07:00
clang-check [clang-check] Add tokens-dump in clang-check. 2021-02-11 09:40:47 +01:00
clang-diff clang-{tools,unittests}: Stop using SourceManager::getBuffer, NFC 2020-10-15 00:35:16 -04:00
clang-extdef-mapping [clang-tooling] Prevent llvm::fatal_error on invalid CLI option 2021-01-29 10:15:06 +01:00
clang-format [clang-format] Add basic support for formatting JSON 2021-06-26 15:20:17 +01:00
clang-format-vs clang-format-vs : Fix Unicode formatting 2019-11-27 09:58:59 +01:00
clang-fuzzer [llvm][clang][mlir] Add checks for the return values from Target::createXXX to prevent protential null deref 2020-11-21 21:04:12 -08:00
clang-import-test Fixup for 8c86197de3 to avoid making it platform-dependent 2020-12-11 17:34:00 -08:00
clang-offload-bundler [HIP] Add --gpu-bundle-output 2021-06-09 23:31:43 -04:00
clang-offload-wrapper [Support] Don't include VirtualFileSystem.h in CommandLine.h 2021-04-21 10:19:01 -04:00
clang-refactor [clang] Rename StringRef _lower() method calls to _insensitive() 2021-06-25 00:22:01 +03:00
clang-rename [clang-tooling] Prevent llvm::fatal_error on invalid CLI option 2021-01-29 10:15:06 +01:00
clang-repl [clang-repl] Add final set of missing library dependencies. 2021-05-13 08:06:58 +00:00
clang-scan-deps [clang] Rename StringRef _lower() method calls to _insensitive() 2021-06-25 00:22:01 +03:00
clang-shlib [CMake][ELF] Link libLLVM.so and libclang-cpp.so with -Bsymbolic-functions 2021-05-13 13:44:57 -07:00
diag-build
diagtool Recommit "[CUDA][HIP] Defer overloading resolution diagnostics for host device functions" 2020-10-19 17:48:04 -04:00
driver [OptTable] Rename PrintHelp to printHelp 2021-06-24 14:47:03 -07:00
libclang [clang] Rename StringRef _lower() method calls to _insensitive() 2021-06-25 00:22:01 +03:00
scan-build Prefer /usr/bin/env xxx over /usr/bin/xxx where xxx = perl, python, awk 2021-02-25 11:32:27 +01:00
scan-build-py Create install targets for scan-build-py. 2021-06-21 13:08:34 -07:00
scan-view Partially Revert "scan-view: Remove Reporter.py and associated AppleScript files" 2021-02-11 19:10:46 -08:00
CMakeLists.txt Create install targets for scan-build-py. 2021-06-21 13:08:34 -07:00