[PATCH] D93528: [clang-format] Add basic support for formatting JSON
    MyDeveloperDay via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Mon Jun 21 04:39:05 PDT 2021
    
    
  
MyDeveloperDay added a comment.
something @sammccall  said about support `foo["name"]`  made me realise that our javascript support doesn't always support what all the options
  x = {
    "firstName" : "John",
    "lastName" : "Smith",
    "isAlive" : true,
    "age" : 27,
    "address" : {
      "streetAddress" : "21 2nd Street",
      "city" : "New York",
      "state" : "NY",
      "postalCode" : "10021-3100"
    },
    "phoneNumbers" : [
      {
        "type" : "home",
        "number" : "212 555-1234",
        "address" : "10 long address line, special road to nowhere",
      },
      {"type" : "office", "number" : "646 555-4567"}
    ],
    "children" : [],
    "children" : [ "foo", "bar" ],
    "children" : [ "foo" ],
    "children" : {},
    "spouse" : null
  }
with
  Language:        JavaScript
  BasedOnStyle:  LLVM
  SpaceInEmptyBlock: true
  SpacesInSquareBrackets: false
made me think it should have been
  "children" : ["foo","bar"],
  "children" : ["foo"],
  "children" : { },
it seems perhaps that ensuring javascript supports these would likely given JSON some of the style capabilities that people might want.
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93528/new/
https://reviews.llvm.org/D93528
    
    
More information about the cfe-commits
mailing list