mirror of
https://github.com/olehomelchenko/astrolabe.git
synced 2025-12-21 21:22:25 +00:00
feat: add JSON schema validation for Vega and Vega-Lite in the editor
This commit is contained in:
21
src/main.js
21
src/main.js
@@ -17,6 +17,27 @@ require(['vs/editor/editor.main'], async function () {
|
|||||||
formatOnType: true
|
formatOnType: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Fetch JSON schemas
|
||||||
|
const vegaSchema = await fetch('https://vega.github.io/schema/vega/v5.json').then(response => response.json());
|
||||||
|
const vegaLiteSchema = await fetch('https://vega.github.io/schema/vega-lite/v5.json').then(response => response.json());
|
||||||
|
|
||||||
|
// Configure JSON schema
|
||||||
|
monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
|
||||||
|
validate: true,
|
||||||
|
schemas: [
|
||||||
|
{
|
||||||
|
uri: "https://vega.github.io/schema/vega/v5.json",
|
||||||
|
fileMatch: ["*"],
|
||||||
|
schema: vegaSchema
|
||||||
|
},
|
||||||
|
{
|
||||||
|
uri: "https://vega.github.io/schema/vega-lite/v5.json",
|
||||||
|
fileMatch: ["*"],
|
||||||
|
schema: vegaLiteSchema
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
const resizer = new PanelResizer(snippetManager);
|
const resizer = new PanelResizer(snippetManager);
|
||||||
window.editor = editor;
|
window.editor = editor;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user