elzr / vim-json

A better JSON for Vim: distinct highlighting of keywords vs values, JSON-specific (non-JS) warnings, quote concealing. Pathogen-friendly.
Other
1.23k stars 111 forks source link

Trailing commas break folding #91

Open guhetier opened 6 years ago

guhetier commented 6 years ago

When there is a trailing comma in a json object, foldings stop at the line with the trailing comma and restart at level one after it.

For instance,

{
  "baz": {
    "foo": "bar",
  }
}

give

+-- 3 lines: {-------------------
  }
}

instead of :

+-- 5 lines: {-------------------

Trailing commas are not valid in the JSON syntax but are accepted by several parser. They are therefore used in a lot of files where folding is currently broken.