-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
do not show errors for trailing commas in web JSON editors #4100
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sqs
added
release-blocker
Prevents us from releasing: https://about.sourcegraph.com/handbook/engineering/releases
webapp
labels
May 17, 2019
felixfbecker
approved these changes
May 17, 2019
felixfbecker
suggested changes
May 17, 2019
@@ -3,6 +3,7 @@ | |||
"$id": "https://raw.githubusercontent.com/sourcegraph/sourcegraph/master/shared/src/schema/extension.schema.json#", | |||
"title": "Sourcegraph extension manifest", | |||
"description": "The Sourcegraph extension manifest describes the extension and the features it provides.", | |||
"allowComments": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, a Sourcegraph manifest is a package.json file, so it does not support comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good point. I will remove it from this file.
felixfbecker
approved these changes
May 17, 2019
fix #4008 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 microsoft/vscode#19992 (comment) and then inferring what changes that might entail, to discover `allowComments` in the JSON Schema is responsible for ignoring trailing comma errors.
sqs
force-pushed
the
allow-trailing-commas-json-editors
branch
from
May 17, 2019 06:27
93b4ff5
to
04c90c5
Compare
sqs
added a commit
that referenced
this pull request
May 17, 2019
fix #4008 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 microsoft/vscode#19992 (comment) and then inferring what changes that might entail, to discover `allowComments` in the JSON Schema is responsible for ignoring trailing comma errors.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
release-blocker
Prevents us from releasing: https://about.sourcegraph.com/handbook/engineering/releases
webapp
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix #4008
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 setallowComments: true
in amonaco.languages.json.jsonDefaults.setDiagnosticsOptions
call. I found this secret fix by finding microsoft/vscode#19992 (comment) and then inferring what changes that might entail, to discoverallowComments
in the JSON Schema is responsible for ignoring trailing comma errors.Verification (the trailing comma has no error, and validation/completion still works):