-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add editor support for JSON config schema #4724
base: main
Are you sure you want to change the base?
Add editor support for JSON config schema #4724
Conversation
f99e430
to
82ea067
Compare
e7e0561
to
eb29575
Compare
65293b7
to
29ede39
Compare
I just had another idea. Since the VSCode extension already knows how to invoke the compiler binary, and the compiler binary can construct the json schema, what if we added a separate compiler command to return the schema text on stdout? It seems like that might be simpler. It would also work better for us internally since we don't access the compiler via an NPM module but a separate binary deployment which would be hard to update to also sync a sibling file. I'll work on a compile diff to add this support. |
9c31623
to
0982908
Compare
|
||
provideTextDocumentContent(uri: Uri): ProviderResult<string> { | ||
if (uri.authority === PACKAGE_JSON_RELAY_CONFIG_SCHEMA_PATH) { | ||
return `{"properties": { "relay": { "$ref": "${RelayTextDocumentContentProvider.scheme}://${RELAY_CONFIG_SCHEMA_PATH}", "description": "Relay.js configuration" }}}`; |
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.
This little recursion trick is so clever. Nice.
} | ||
|
||
if (uri.authority === RELAY_CONFIG_SCHEMA_PATH) { | ||
this.cachedJsonSchema ||= this.loadConfigJsonSchema(); |
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.
If the user changes their relay binary path in the config file, does this get invalidated correctly?
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.
No, but you have to restart the extension anyways because the binary information is only loaded once at startup atm.
0982908
to
7e70f40
Compare
The Prettier and ESLint rules are conflicting... Nice |
7e70f40
to
8a02bdb
Compare
@@ -25,6 +25,7 @@ module.exports = { | |||
'operator-linebreak': 'off', | |||
'@typescript-eslint/indent': 'off', | |||
'@typescript-eslint/object-curly-spacing': 'off', | |||
'@typescript-eslint/brace-style': 'off', |
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.
Good call.
No description provided.