-
Notifications
You must be signed in to change notification settings - Fork 29k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API doesnt update settings if there are trailing commas in settings.json #19625
Comments
I think it would be nice if we would allow to edit a JSON when it has trailing commas. /cc @sandy081 |
@aeschli I had implemented this in Config edit service in last milestone when writing into the model. This is to ignore errors. But in this case, we write into the disk directly, so ignoring errors might not be a good idea. So how about having an option to ignore trailing comma (to json language server not sure) so that the json is still valid ? |
Yeah, +1 for only ignoring trailing commas but not in general any error. |
The json parser that we use (json.ts, our own implementation) already ignores trailing commas. It doesn't matter of the file is written to disk or not, as its our file and we read it. |
I use the json parser (json.ts) which is giving errors while parsing the json. This is pre-validation step before writing. If there are errors in parsing here, we quit (if it is writing to disk). |
Ok, errors are reported, but the parser continues to parse and will report all properties. |
Sure will do. Thanks for the pointer. |
@aeschli Fixed it as we discussed
|
Awesome! |
To verify:
|
This is a great fix! |
Users of my Settings sync extension having problems shanalikhan/code-settings-sync#190
When they have trailing commas in settings.json , API doenst allow extension to add keys and values in settings.json file , Giving error code
4
.There should be way in code to let users know that they dont have valid JSON in settings.json file e.g trailing commas, without opening that file may be in status bar or let API to add settings in the settings.json file even it have trailing commas.
The text was updated successfully, but these errors were encountered: