Skip to content

Commit

Permalink
fix: Do not override existing json diagnostic schemas (#3523)
Browse files Browse the repository at this point in the history
  • Loading branch information
bboure committed Feb 1, 2024
1 parent 25c3bfd commit 88d76ca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/healthy-toes-grab.md
@@ -0,0 +1,5 @@
---
'monaco-graphql': patch
---

Fix JSON diagnostics for multiple editors
7 changes: 6 additions & 1 deletion packages/monaco-graphql/src/languageFeatures.ts
Expand Up @@ -150,12 +150,17 @@ export class DiagnosticsAdapter {
schema: jsonSchema,
fileMatch: variablesUris,
};
const currentSchemas =
languages.json.jsonDefaults.diagnosticsOptions.schemas?.filter(
s => s.uri !== schemaUri,
) || [];

// TODO: export from api somehow?
languages.json.jsonDefaults.setDiagnosticsOptions({
schemaValidation: 'error',
validate: true,
...this.defaults?.diagnosticSettings?.jsonDiagnosticSettings,
schemas: [configResult],
schemas: [...currentSchemas, configResult],
enableSchemaRequest: false,
});
}
Expand Down

0 comments on commit 88d76ca

Please sign in to comment.