Skip to content

Commit 88d76ca

Browse files
authored
fix: Do not override existing json diagnostic schemas (#3523)
1 parent 25c3bfd commit 88d76ca

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.changeset/healthy-toes-grab.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'monaco-graphql': patch
3+
---
4+
5+
Fix JSON diagnostics for multiple editors

packages/monaco-graphql/src/languageFeatures.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,17 @@ export class DiagnosticsAdapter {
150150
schema: jsonSchema,
151151
fileMatch: variablesUris,
152152
};
153+
const currentSchemas =
154+
languages.json.jsonDefaults.diagnosticsOptions.schemas?.filter(
155+
s => s.uri !== schemaUri,
156+
) || [];
157+
153158
// TODO: export from api somehow?
154159
languages.json.jsonDefaults.setDiagnosticsOptions({
155160
schemaValidation: 'error',
156161
validate: true,
157162
...this.defaults?.diagnosticSettings?.jsonDiagnosticSettings,
158-
schemas: [configResult],
163+
schemas: [...currentSchemas, configResult],
159164
enableSchemaRequest: false,
160165
});
161166
}

0 commit comments

Comments
 (0)