diff --git a/webClient/package-lock.json b/webClient/package-lock.json index 3b01509c..a5af8857 100644 --- a/webClient/package-lock.json +++ b/webClient/package-lock.json @@ -3574,6 +3574,16 @@ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dev": true, + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -6485,6 +6495,13 @@ } } }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "dev": true, + "optional": true + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -8923,6 +8940,44 @@ "vscode-languageserver-types": "^3.7.0" } }, + "monaco-yaml": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/monaco-yaml/-/monaco-yaml-3.2.1.tgz", + "integrity": "sha512-2geAd5I7H1SMgwTHBuyPAPK9WTAzxbl9XwDl5h6NY6n9j4qnlLLQKK1i0P9cAmUiV2uaiViz69RLNWqVU5BVsg==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.0", + "js-yaml": "^4.0.0", + "path-browserify": "^1.0.0", + "prettier": "2.0.5", + "vscode-languageserver-textdocument": "^1.0.0", + "vscode-languageserver-types": "^3.0.0", + "yaml-language-server-parser": "^0.1.0" + }, + "dependencies": { + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", + "dev": true + } + } + }, "move-concurrently": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", @@ -8991,6 +9046,13 @@ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, + "nan": { + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", + "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==", + "dev": true, + "optional": true + }, "nanoid": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.2.0.tgz", @@ -11397,6 +11459,12 @@ "uniq": "^1.0.1" } }, + "prettier": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", + "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", + "dev": true + }, "pretty-bytes": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", @@ -13888,6 +13956,12 @@ "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.6.2.tgz", "integrity": "sha512-T24Jb5V48e4VgYliUXMnZ379ItbrXgOimweKaJshD84z+8q7ZOZjJan0MeDe+Ugb+uqERDVV8SBmemaGMSMugA==" }, + "vscode-languageserver-textdocument": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.3.tgz", + "integrity": "sha512-ynEGytvgTb6HVSUwPJIAZgiHQmPCx8bZ8w5um5Lz+q5DjP0Zj8wTFhQpyg8xaMvefDytw2+HH5yzqS+FhsR28A==", + "dev": true + }, "vscode-languageserver-types": { "version": "3.16.0", "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0.tgz", @@ -14060,7 +14134,11 @@ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "dev": true, - "optional": true + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + } }, "glob-parent": { "version": "3.1.0", @@ -15152,7 +15230,11 @@ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "dev": true, - "optional": true + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + } }, "glob-parent": { "version": "3.1.0", @@ -15554,6 +15636,12 @@ "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", "dev": true }, + "yaml-language-server-parser": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/yaml-language-server-parser/-/yaml-language-server-parser-0.1.3.tgz", + "integrity": "sha512-xD2I+6M/vqQvcy4ded8JpXUaDHXmZMdhIO3OpuiFxstutwnW4whrfDzNcrsfXVdgMWqOUpdv3747Q081PFN1+g==", + "dev": true + }, "yargs": { "version": "13.3.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", diff --git a/webClient/package.json b/webClient/package.json index 85473f79..8b704439 100644 --- a/webClient/package.json +++ b/webClient/package.json @@ -47,6 +47,7 @@ "html-loader": "~0.5.5", "monaco-editor": "^0.20.0", "monaco-editor-webpack-plugin": "^1.9.0", + "monaco-yaml": "~3.2.1", "rxjs": "~6.6.0", "sass": "~1.26.0", "sass-loader": "~8.0.0", diff --git a/webClient/src/app/editor/code-editor/monaco/monaco.service.ts b/webClient/src/app/editor/code-editor/monaco/monaco.service.ts index f0fdc18e..883b1056 100644 --- a/webClient/src/app/editor/code-editor/monaco/monaco.service.ts +++ b/webClient/src/app/editor/code-editor/monaco/monaco.service.ts @@ -41,6 +41,7 @@ export class MonacoService implements OnDestroy { constructor( @Inject(Angular2InjectionTokens.LOGGER) private log: ZLUX.ComponentLogger, + @Inject(Angular2InjectionTokens.PLUGIN_DEFINITION) private pluginDefinition: ZLUX.ContainerPluginDefinition, private http: HttpService, private dataAdapter: DataAdapterService, private editorControl: EditorControlService, @@ -79,6 +80,7 @@ export class MonacoService implements OnDestroy { } document.addEventListener("keydown", this.fileSaveListener); + this.initJsonSchemas(); //this.editorControl.saveAllFile.subscribe(() => { //this.saveAllFile(); @@ -492,6 +494,23 @@ export class MonacoService implements OnDestroy { cleanDecoration() { this.editorControl.editor.getValue().deltaDecorations(this.decorations, []); } + + initJsonSchemas(): void { + const uri = ZoweZLUX.uriBroker.pluginResourceUri(this.pluginDefinition.getBasePlugin(), 'assets/schemas/zowe-schema.json'); + (monaco.languages as any).yaml.yamlDefaults.setDiagnosticsOptions({ + hover: true, + completion: true, + validate: true, + format: true, + enableSchemaRequest: true, + schemas: [ + { + fileMatch: ['inmemory://**zowe.yaml/**'], + uri: uri + }, + ], + }); + } } /* diff --git a/webClient/src/app/zowe-schema.json b/webClient/src/app/zowe-schema.json new file mode 100644 index 00000000..8fa5e0be --- /dev/null +++ b/webClient/src/app/zowe-schema.json @@ -0,0 +1,74 @@ +{ + "name": "zowe_yaml_schema", + "$id": "http//zowe.org/schemas/yaml-2.0.json", + "type": "object", + "required": [ + "zowe", + "externalPort" + ], + "properties": { + "zowe": { + "properties": { + "setup": { + "type": "object", + "properties": { + "mvs": { + "type": "object", + "description": "MVS data set related configurations", + "properties": { + "proclib": { + "$ref": "#/$defs/dataset" + }, + "parmlib": { + "$ref": "#/$defs/dataset" + }, + "hlq": { + "description": "where Zowe MVS data sets will be installed", + "$ref": "#/$defs/dataset" + } + } + } + } + } + } + }, + "job": { + "type": "object", + "required": [ + "name", + "prefix" + ], + "properties": { + "name": { + "$ref": "#/$defs/jobname" + }, + "prefix": { + "type": "string" + } + } + }, + "externalPort": { + "type": "integer" + }, + "logDirectory": { + "type": "string" + } + }, + "$defs": { + "dataset": { + "type": "string", + "minLength": 3, + "maxLength": 44 + }, + "jobname": { + "type": "string", + "minLength": 3, + "maxLength": 8 + }, + "tcpPort": { + "type": "integer", + "minimum": 1024, + "maximum": 65535 + } + } +} diff --git a/webClient/webpack.build.config.js b/webClient/webpack.build.config.js index a7c6b63a..a67df87d 100644 --- a/webClient/webpack.build.config.js +++ b/webClient/webpack.build.config.js @@ -83,7 +83,19 @@ var config = { threshold: 50000, minRatio: 0.8 }) - , new MonacoWebpackPlugin({publicPath: pubPath}) + , new MonacoWebpackPlugin({ + publicPath: pubPath, + customLanguages: [ + { + label: 'yaml', + entry: ['monaco-yaml', 'vs/basic-languages/yaml/yaml.contribution'], + worker: { + id: 'monaco-yaml/yamlWorker', + entry: 'monaco-yaml/lib/esm/yaml.worker', + }, + }, + ], + }) ] };