Skip to content

Commit 88d76ca

Browse files
authoredFeb 1, 2024
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

+5
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

+6-1
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)
Please sign in to comment.