From d387351c5f6e1785a3ede4916647c9053894f6d9 Mon Sep 17 00:00:00 2001 From: Andrew Palm Date: Tue, 20 Feb 2018 19:24:15 -0500 Subject: [PATCH 1/2] Update JavaScript for configure-json-defaults sample --- .../configure-json-defaults/sample.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/website/playground/new-samples/extending-language-services/configure-json-defaults/sample.js b/website/playground/new-samples/extending-language-services/configure-json-defaults/sample.js index 71647c83..3a0d1b92 100644 --- a/website/playground/new-samples/extending-language-services/configure-json-defaults/sample.js +++ b/website/playground/new-samples/extending-language-services/configure-json-defaults/sample.js @@ -1,8 +1,12 @@ // Configures two JSON schemas, with references. +var id = "foo.json"; + monaco.languages.json.jsonDefaults.setDiagnosticsOptions({ + validate: true, schemas: [{ uri: "http://myserver/foo-schema.json", + fileMatch: [id], schema: { type: "object", properties: { @@ -16,6 +20,7 @@ monaco.languages.json.jsonDefaults.setDiagnosticsOptions({ } },{ uri: "http://myserver/bar-schema.json", + fileMatch: [id], schema: { type: "object", properties: { @@ -30,11 +35,13 @@ monaco.languages.json.jsonDefaults.setDiagnosticsOptions({ var jsonCode = [ '{', - ' "$schema": "http://myserver/foo-schema.json"', + ' "p1": "v3",', + ' "p2": false', "}" ].join('\n'); +var model = monaco.editor.createModel(jsonCode, "json", id); + monaco.editor.create(document.getElementById("container"), { - value: jsonCode, - language: "json" -}); \ No newline at end of file + model: model +}); From 00b766829bd666a751eda34fb386d0a9e7afebc5 Mon Sep 17 00:00:00 2001 From: Andrew Palm Date: Tue, 20 Feb 2018 19:38:09 -0500 Subject: [PATCH 2/2] Run gulp generate-test-samples --- ...-language-services-configure-json-defaults.html | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/test/playground.generated/extending-language-services-configure-json-defaults.html b/test/playground.generated/extending-language-services-configure-json-defaults.html index 3591d903..04b352ba 100644 --- a/test/playground.generated/extending-language-services-configure-json-defaults.html +++ b/test/playground.generated/extending-language-services-configure-json-defaults.html @@ -38,9 +38,13 @@ loadEditor(function() { // Configures two JSON schemas, with references. +var id = "foo.json"; + monaco.languages.json.jsonDefaults.setDiagnosticsOptions({ + validate: true, schemas: [{ uri: "http://myserver/foo-schema.json", + fileMatch: [id], schema: { type: "object", properties: { @@ -54,6 +58,7 @@ monaco.languages.json.jsonDefaults.setDiagnosticsOptions({ } },{ uri: "http://myserver/bar-schema.json", + fileMatch: [id], schema: { type: "object", properties: { @@ -68,15 +73,18 @@ monaco.languages.json.jsonDefaults.setDiagnosticsOptions({ var jsonCode = [ '{', - ' "$schema": "http://myserver/foo-schema.json"', + ' "p1": "v3",', + ' "p2": false', "}" ].join('\n'); +var model = monaco.editor.createModel(jsonCode, "json", id); + monaco.editor.create(document.getElementById("container"), { - value: jsonCode, - language: "json" + model: model }); + /*----------------------------------------SAMPLE CSS END*/ });