Skip to content

do not show errors for trailing commas in web JSON editors

Warren Gifford requested to merge allow-trailing-commas-json-editors into master

Created by: sqs

fix #4008 (closed)

All JSON documents we use (for settings, site config, external services, and extension manifests) support trailing commas on the frontend and backend. However, an upgrade to monaco-editor unexpectedly caused the Monaco JSON editors in our UI to show red squiggly errors for trailing commas.

The (undocumented) way to do this is to add allowComments to the root of the JSON Schema. It is not sufficient to set allowComments: true in a monaco.languages.json.jsonDefaults.setDiagnosticsOptions call. I found this secret fix by finding https://github.com/microsoft/vscode/issues/19992#issuecomment-347124969 and then inferring what changes that might entail, to discover allowComments in the JSON Schema is responsible for ignoring trailing comma errors.

Verification (the trailing comma has no error, and validation/completion still works):

image

Merge request reports

Loading