Steps to Reproduce:
Does this issue occur when all extensions are disabled?: Yes
Only noticed this appear as of 1.38.0.
Copied problem data:
{
"resource": "/0/settings.json",
"owner": "_generated_diagnostic_collection_name_#0",
"code": "519",
"severity": 4,
"message": "Trailing comma",
"source": "jsonc",
"startLineNumber": 2436,
"startColumn": 1,
"endLineNumber": 2436,
"endColumn": 2
}
On an additional note, it says the source is jsonc language, but I thought jsonc allowed trailing commas?
I have the same problem.
Same here on Mac. I also have prettier as the default formatter:
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
Turning it off doesn't help though.
My tsconfig.json files recently started showing errors when there is a trailing comma in them. TSC allows trailing commas and I would rather not remove them as it makes editing easier. What changed that is causing jsonc checker to start erroring on trailing comma? How can I go back to the old behavior?
Same issue here. Happened after I updated to 1.38, and edited user setting.
I'm also using split json config:
"workbench.settings.editor": "json",
"workbench.settings.useSplitJSON": true,
and using prettier as the default formatter
this is happening to me -- every time i open or close the settings.json split viewer, a new problem is created.
Same here.
@aeschli Is this new with jsonc that showing a warning with trailing comma?
["a",]
There are several file formats out there that allow comments in JSON but not trailing commas.
(e.g. tslint.json, eslint.json)
So I made a change so that by default jsonc no longer accepts trailing commas.
Trailing commas are only ignored for jsonc files if they have a schema associated that specifies that trailing commas are allowed.
That's done with a property in the schema root: allowTrailingCommas: true
(note that I just changed from allowsTrailingCommas to allowTrailingCommas, please only use allowTrailingCommas)
I added that to the schemas of our settings files. Note that the schemas of our settings files are dynamically generated, so it's all in code
It looks like the error is coming from the default settings 'editor', which has no schema associated.
@sandy081 Can you associate a schema there, or just generate code without trailing comma?
I'll make a fix for tsconfig.json
Thanks @aeschli, I can see if I can avoid trailing comma.
So this is closed as in fixed? I just got referred here after opening #81920. Is the fix in the nightly build?
Yes, in the insiders ('nightly') build.
Most helpful comment
There are several file formats out there that allow comments in JSON but not trailing commas.
(e.g. tslint.json, eslint.json)
So I made a change so that by default
jsoncno longer accepts trailing commas.Trailing commas are only ignored for jsonc files if they have a schema associated that specifies that trailing commas are allowed.
That's done with a property in the schema root:
allowTrailingCommas: true(note that I just changed from
allowsTrailingCommastoallowTrailingCommas, please only useallowTrailingCommas)I added that to the schemas of our settings files. Note that the schemas of our settings files are dynamically generated, so it's all in code
It looks like the error is coming from the default settings 'editor', which has no schema associated.
@sandy081 Can you associate a schema there, or just generate code without trailing comma?
I'll make a fix for
tsconfig.json