profile
viewpoint

Ask questionsTolerate trailing commas in jsonc format

<!-- ⚠️⚠️ Do Not Delete This! feature_request_template ⚠️⚠️ --> <!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ --> <!-- Please search existing issues to avoid creating duplicates. -->

<!-- Describe the feature you'd like. -->

Would it be possible to add tolerance for trailing commas to the jsonc (JSON With Comments) format? Even as an optional setting that is off by default. While I can understand not adding support to the json (spec-compliant) format, there doesn't seem to be a good reason not to add it (either on automatically or configurable) to jsonc.

In case there's any doubt over what I mean, here's an example.

{
    "foo": 123,
    "bar": [
        "abc",
        "def",
        "ghi", // trailing comma: okay!
    ], // trailing comma: okay!
}
microsoft/vscode

Answer questions alexreg

Ah, I see, thanks for explaining. I think you're right... many "jsonc" parsers accept trailing commas, while many don't. The Python one that I'm using happily does (and indeed I chose it partly for that reason).

Indeed, I was the one (as far as I'm aware) who requested the allowTrailingCommas feature for settings files, and that's great. :-)

No, I don't have a JSON schema. Maybe a setting like allowTrailingCommas could be added to the [json] language section in VS Code settings? Ideally this would be configurable on a per-directory or even per-file basis, but I suppose that comes down to how VS Code workspace settings work in general. Perhaps support for that has recently been added?

useful!

Related questions

XHR Failed on trying to install plugins via Visual Studio code hot 10
the terminal process terminated with exit code #259 hot 9
Insiders - We cannot connect to the Extensions Marketplace
The terminal shell CWD &#34;/c:/User...&#34; does not exist - vscode hot 4
Git Fetch fails with Missing or invalid credentials hot 3
Bad message: Cannot launch program 'c:\...'; setting the 'outFiles' attribute might help. hot 3
Show offending file path, when "Tokenization is skipped for long lines for performance reasons. The length of a long line can be configured via `editor.maxTokenizationLineLength`." hot 3
Wrong separator in path when debugging c++ - vscode hot 3
VS Code unins000.exe starts leading its own life, suddenly throwing a popup warning without user interaction hot 3
launch: program ''does not exist hot 2
format code alt + shift + f hot 2
Corrupt ZIP: end of central directory record signature not found hot 2
"Initializing JS/TS Language Features" appears every time I open a JS file hot 2
The token '&&' is not a valid statement separator in this version. hot 2
Paths separators in build config being escaped/stripped out prior to build command being run hot 2
source:https://uonfu.com/
Github User Rank List