Merge pull request #60 from remcohaszing/enhance-types

Add missing diagnostics options in types
This commit is contained in:
Remco Haszing 2021-07-18 14:44:40 +02:00 committed by GitHub
commit 9436e1f034
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 9 deletions

View file

@ -5,7 +5,7 @@ import './index.css';
import 'monaco-editor';
import { editor, languages } from 'monaco-editor/esm/vs/editor/editor.api';
import 'monaco-yaml/lib/esm/monaco.contribution';
import 'monaco-yaml';
// NOTE: using loader syntax becuase Yaml worker imports editor.worker directly and that
// import shouldn't go through loader syntax.
import EditorWorker from 'worker-loader!monaco-editor/esm/vs/editor/editor.worker';

13
package-lock.json generated
View file

@ -11,6 +11,7 @@
"examples/*"
],
"dependencies": {
"@types/json-schema": "^7.0.8",
"js-yaml": "^3.14.1",
"yaml-ast-parser-custom-tags": "^0.0.43"
},
@ -676,8 +677,7 @@
"node_modules/@types/json-schema": {
"version": "7.0.8",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.8.tgz",
"integrity": "sha512-YSBPTLTVm2e2OoQIDYx8HaeWJ5tTToLH67kXR7zYNGupXMEHa2++G8k+DczX2cFVgalypqtyZIcU19AFcmOpmg==",
"dev": true
"integrity": "sha512-YSBPTLTVm2e2OoQIDYx8HaeWJ5tTToLH67kXR7zYNGupXMEHa2++G8k+DczX2cFVgalypqtyZIcU19AFcmOpmg=="
},
"node_modules/@types/mdast": {
"version": "3.0.7",
@ -12907,8 +12907,7 @@
"@types/json-schema": {
"version": "7.0.8",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.8.tgz",
"integrity": "sha512-YSBPTLTVm2e2OoQIDYx8HaeWJ5tTToLH67kXR7zYNGupXMEHa2++G8k+DczX2cFVgalypqtyZIcU19AFcmOpmg==",
"dev": true
"integrity": "sha512-YSBPTLTVm2e2OoQIDYx8HaeWJ5tTToLH67kXR7zYNGupXMEHa2++G8k+DczX2cFVgalypqtyZIcU19AFcmOpmg=="
},
"@types/mdast": {
"version": "3.0.7",
@ -18202,9 +18201,10 @@
"monaco-yaml": {
"version": "file:",
"requires": {
"@types/json-schema": "*",
"@typescript-eslint/eslint-plugin": "^4.28.3",
"@typescript-eslint/parser": "^4.28.3",
"eslint": "*",
"eslint": "^7.30.0",
"eslint-config-remcohaszing": "^3.4.0",
"husky": "^7.0.1",
"js-yaml": "^3.14.1",
@ -18705,8 +18705,7 @@
"@types/json-schema": {
"version": "7.0.8",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.8.tgz",
"integrity": "sha512-YSBPTLTVm2e2OoQIDYx8HaeWJ5tTToLH67kXR7zYNGupXMEHa2++G8k+DczX2cFVgalypqtyZIcU19AFcmOpmg==",
"dev": true
"integrity": "sha512-YSBPTLTVm2e2OoQIDYx8HaeWJ5tTToLH67kXR7zYNGupXMEHa2++G8k+DczX2cFVgalypqtyZIcU19AFcmOpmg=="
},
"@types/mdast": {
"version": "3.0.7",

View file

@ -33,6 +33,7 @@
"url": "https://github.com/pengx17/monaco-yaml/issues"
},
"dependencies": {
"@types/json-schema": "^7.0.8",
"js-yaml": "^3.14.1",
"yaml-ast-parser-custom-tags": "^0.0.43"
},

13
src/monaco.d.ts vendored
View file

@ -1,8 +1,19 @@
import { JSONSchema4, JSONSchema6, JSONSchema7 } from 'json-schema';
import { IEvent } from 'monaco-editor/esm/vs/editor/editor.api';
declare module 'monaco-editor/esm/vs/editor/editor.api' {
namespace languages.yaml {
export interface DiagnosticsOptions {
/**
* If set, enable schema based autocompletion.
*/
readonly completion?: boolean;
/**
* If set, enable hover typs based the JSON schema.
*/
readonly hover?: boolean;
/**
* If set, the validator will be enabled and perform syntax validation as well as schema
* based validation.
@ -25,7 +36,7 @@ declare module 'monaco-editor/esm/vs/editor/editor.api' {
/**
* The schema for the given URI.
*/
readonly schema?: unknown;
readonly schema?: JSONSchema4 | JSONSchema6 | JSONSchema7;
}[];
/**