[all-commits] [llvm/llvm-project] 95b394: [clang-format] JSON formatting add new option for ...

MyDeveloperDay via All-commits all-commits at lists.llvm.org
Mon Sep 19 09:55:25 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 95b39471110680f609cf56f5babf031a1c855d64
      https://github.com/llvm/llvm-project/commit/95b39471110680f609cf56f5babf031a1c855d64
  Author: mydeveloperday <mydeveloperday at gmail.com>
  Date:   2022-09-19 (Mon, 19 Sep 2022)

  Changed paths:
    M clang/docs/ClangFormatStyleOptions.rst
    M clang/include/clang/Format/Format.h
    M clang/lib/Format/Format.cpp
    M clang/lib/Format/TokenAnnotator.cpp
    M clang/unittests/Format/FormatTestJson.cpp

  Log Message:
  -----------
  [clang-format] JSON formatting add new option for controlling newlines in json arrays

Working in a mixed environment of both vscode/vim with a team configured prettier configuration, this can leave clang-format and prettier fighting each other over the formatting of arrays, both simple arrays of elements.

This review aims to add some "control knobs" to the Json formatting in clang-format to help align the two tools so they can be used interchangeably.

This will allow simply arrays `[1, 2, 3]` to remain on a single line but will break those arrays based on context within that array.

Happy to change the name of the option (this is the third name I tried)

Reviewed By: HazardyKnusperkeks, owenpan

Differential Revision: https://reviews.llvm.org/D133589




More information about the All-commits mailing list