microsoft/node-jsonc-parser

Option to keep spaces before inline comments

tiagoefmoraes opened this issue · 0 comments

Add a keepSpaces or keepSpacesBeforeLineComments similar too keepLines that preserves the spaces between values and inline comments at the end of the line.

This will help to avoid unnecessary changes when formatting tsconfig.json files:

Original:

    /* Language and Environment */
    "target": "es2016",                                  /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
    // "lib": [],                                        /* Specify a set of bundled library declaration files that describe the target runtime environment. */

Formatted:

    /* Language and Environment */
    "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
    // "lib": [],                                        /* Specify a set of bundled library declaration files that describe the target runtime environment. */

Diff:

     /* Language and Environment */
-    "target": "es2016",                                  /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
+    "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
     // "lib": [],                                        /* Specify a set of bundled library declaration files that describe the target runtime environment. */