extending-language-services-configure-json-defaults.html 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <!DOCTYPE html>
  2. <!-- THIS IS A GENERATED FILE VIA gulp generate-test-samples -->
  3. <html>
  4. <head>
  5. <base href="..">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  7. <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  8. </head>
  9. <body>
  10. <style>
  11. /*----------------------------------------SAMPLE CSS START*/
  12. /*----------------------------------------SAMPLE CSS END*/
  13. </style>
  14. <a class="loading-opts" href="playground.generated/index.html">[&lt;&lt; BACK]</a> <br/>
  15. THIS IS A GENERATED FILE VIA gulp generate-test-samples
  16. <div id="bar" style="margin-bottom: 6px;"></div>
  17. <div style="clear:both"></div>
  18. <div id="outer-container" style="width:800px;height:450px;border: 1px solid grey">
  19. <!-- ----------------------------------------SAMPLE HTML START-->
  20. <div id="container" style="height:100%;"></div>
  21. <!-- ----------------------------------------SAMPLE HTML END-->
  22. </div>
  23. <div style="clear:both"></div>
  24. <script src="../metadata.js"></script>
  25. <script src="dev-setup.js"></script>
  26. <script>
  27. loadEditor(function() {
  28. /*----------------------------------------SAMPLE JS START*/
  29. // Configures two JSON schemas, with references.
  30. monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
  31. schemas: [{
  32. uri: "http://myserver/foo-schema.json",
  33. schema: {
  34. type: "object",
  35. properties: {
  36. p1: {
  37. enum: [ "v1", "v2"]
  38. },
  39. p2: {
  40. $ref: "http://myserver/bar-schema.json"
  41. }
  42. }
  43. }
  44. },{
  45. uri: "http://myserver/bar-schema.json",
  46. schema: {
  47. type: "object",
  48. properties: {
  49. q1: {
  50. enum: [ "x1", "x2"]
  51. }
  52. }
  53. }
  54. }]
  55. });
  56. var jsonCode = [
  57. '{',
  58. ' "$schema": "http://myserver/foo-schema.json"',
  59. "}"
  60. ].join('\n');
  61. monaco.editor.create(document.getElementById("container"), {
  62. value: jsonCode,
  63. language: "json"
  64. });
  65. /*----------------------------------------SAMPLE CSS END*/
  66. });
  67. </script>
  68. </body>
  69. </html>