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 7
the terminal process terminated with exit code #259 hot 7
The terminal shell CWD &#34;/c:/User...&#34; does not exist - vscode hot 4
Insiders - We cannot connect to the Extensions Marketplace hot 4
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
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
dart is not recognized as internal or external command hot 2
Logitech MX Master: Horizontal scrolling via scroll wheel doesn't work hot 2
VS Code doesn't read Git packed-refs hot 2
Is it possible to use wsl bash php for php.validate.executablePath hot 2
Error message: Sorry, Java IntelliCode Support has problem, for more details, please view Output hot 2
source:https://uonfu.com/
Github User Rank List