Add monaco-yaml for proper yaml support (#25887)

* Add monaco-yaml for proper yaml support

The basic yaml support built into monaco didn't suffice for the Batch Changes editor. The worker will only be loaded on that page, so this won't cause any additional payload to be loaded on any other pages.
With this worker, we get
- Proper formatting
- Actual JSON schema support for auto completion, hovers and error detection

* Allow Python-2.0 license

Signed off by legal: https://sourcegraph.slack.com/archives/C01GJFE26BX/p1633986709356600
This commit is contained in:
Erik Seliger 2021-10-13 01:58:58 +02:00 committed by GitHub
parent 21220c5653
commit 14ebb8336f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 52 additions and 12 deletions

View File

@ -4,9 +4,19 @@ import type MonacoWebpackPlugin from 'monaco-editor-webpack-plugin'
* Configuration for https://github.com/microsoft/monaco-editor-webpack-plugin.
*/
export const MONACO_LANGUAGES_AND_FEATURES: Required<
Pick<NonNullable<ConstructorParameters<typeof MonacoWebpackPlugin>[0]>, 'languages' | 'features'>
Pick<
NonNullable<ConstructorParameters<typeof MonacoWebpackPlugin>[0]>,
'languages' | 'features' | 'customLanguages'
>
> = {
languages: ['json', 'yaml'],
customLanguages: [
{
label: 'yaml',
entry: 'monaco-yaml/lib/esm/monaco.contribution',
worker: { id: 'vs/language/yaml/yamlWorker', entry: 'monaco-yaml/lib/esm/yaml.worker' },
},
],
features: [
'bracketMatching',
'clipboard',

View File

@ -347,3 +347,9 @@
:why: Inference broken, LICENSE file lives at https://github.com/aws/smithy-go/blob/main/LICENSE
:versions: []
:when: 2021-04-14 12:51:19.503802000 Z
- - :permit
- Python-2.0
- :who:
:why: Used by argparse
:versions: []
:when: 2021-10-12 11:17:37.706276000 Z

View File

@ -375,6 +375,7 @@
"mdi-react": "^7.3.0",
"minimatch": "^3.0.4",
"monaco-editor": "^0.24.0",
"monaco-yaml": "^3.2.1",
"nice-ticks": "^1.0.1",
"open-color": "^1.8.0",
"path-browserify": "^1.0.1",

View File

@ -5178,10 +5178,10 @@
"@types/tough-cookie" "*"
parse5 "^4.0.0"
"@types/json-schema@*", "@types/json-schema@^7.0.4", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.6", "@types/json-schema@^7.0.7":
version "7.0.8"
resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.8.tgz#edf1bf1dbf4e04413ca8e5b17b3b7d7d54b59818"
integrity sha512-YSBPTLTVm2e2OoQIDYx8HaeWJ5tTToLH67kXR7zYNGupXMEHa2++G8k+DczX2cFVgalypqtyZIcU19AFcmOpmg==
"@types/json-schema@*", "@types/json-schema@^7.0.0", "@types/json-schema@^7.0.4", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.6", "@types/json-schema@^7.0.7":
version "7.0.9"
resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d"
integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==
"@types/json-stable-stringify@^1.0.32":
version "1.0.32"
@ -15400,7 +15400,7 @@ js-tokens@^3.0.2:
resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b"
integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls=
js-yaml@4.0.0:
js-yaml@4.0.0, js-yaml@^4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-4.0.0.tgz#f426bc0ff4b4051926cd588c71113183409a121f"
integrity sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q==
@ -17034,6 +17034,19 @@ monaco-editor@^0.24.0:
resolved "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.24.0.tgz#990b55096bcc95d08d8d28e55264c6eb17707269"
integrity sha512-o1f0Lz6ABFNTtnEqqqvlY9qzNx24rQZx1RgYNQ8SkWkE+Ka63keHH/RqxQ4QhN4fs/UYOnvAtEUZsPrzccH++A==
monaco-yaml@^3.2.1:
version "3.2.1"
resolved "https://registry.npmjs.org/monaco-yaml/-/monaco-yaml-3.2.1.tgz#45ce9f7f8140dc26249ac99eb0a9e5a9ab9beb87"
integrity sha512-2geAd5I7H1SMgwTHBuyPAPK9WTAzxbl9XwDl5h6NY6n9j4qnlLLQKK1i0P9cAmUiV2uaiViz69RLNWqVU5BVsg==
dependencies:
"@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"
moo-color@^1.0.2:
version "1.0.2"
resolved "https://registry.npmjs.org/moo-color/-/moo-color-1.0.2.tgz#837c40758d2d58763825d1359a84e330531eca64"
@ -18178,7 +18191,7 @@ pascalcase@^0.1.1:
resolved "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14"
integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=
path-browserify@^1.0.1:
path-browserify@^1.0.0, path-browserify@^1.0.1:
version "1.0.1"
resolved "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd"
integrity sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==
@ -19033,6 +19046,11 @@ prepend-http@^2.0.0:
resolved "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897"
integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=
prettier@2.0.5:
version "2.0.5"
resolved "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz#d6d56282455243f2f92cc1716692c08aa31522d4"
integrity sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==
prettier@^2.2.0, prettier@^2.2.1, prettier@~2.2.1:
version "2.2.1"
resolved "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5"
@ -23779,12 +23797,12 @@ vscode-languageserver-protocol@^3.14.1:
vscode-jsonrpc "^5.0.1"
vscode-languageserver-types "3.15.1"
vscode-languageserver-textdocument@^1.0.1:
version "1.0.1"
resolved "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.1.tgz#178168e87efad6171b372add1dea34f53e5d330f"
integrity sha512-UIcJDjX7IFkck7cSkNNyzIz5FyvpQfY7sdzVy+wkKN/BLaD4DQ0ppXQrKePomCxTS7RrolK1I0pey0bG9eh8dA==
vscode-languageserver-textdocument@^1.0.0, vscode-languageserver-textdocument@^1.0.1:
version "1.0.2"
resolved "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.2.tgz#2f9f6bd5b5eb3d8e21424c0c367009216f016236"
integrity sha512-T7uPC18+f8mYE4lbVZwb3OSmvwTZm3cuFhrdx9Bn2l11lmp3SvSuSVjy2JtvrghzjAo4G6Trqny2m9XGnFnWVA==
vscode-languageserver-types@3.15.1, vscode-languageserver-types@^3.15.1:
vscode-languageserver-types@3.15.1, vscode-languageserver-types@^3.0.0, vscode-languageserver-types@^3.15.1:
version "3.15.1"
resolved "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.1.tgz#17be71d78d2f6236d414f0001ce1ef4d23e6b6de"
integrity sha512-+a9MPUQrNGRrGU630OGbYVQ+11iOIovjCkqxajPa9w57Sd5ruK8WQNsslzpa0x/QJqC8kRc2DUxWjIFwoNm4ZQ==
@ -24540,6 +24558,11 @@ yaml-ast-parser@^0.0.43:
resolved "https://registry.npmjs.org/yaml-ast-parser/-/yaml-ast-parser-0.0.43.tgz#e8a23e6fb4c38076ab92995c5dca33f3d3d7c9bb"
integrity sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A==
yaml-language-server-parser@^0.1.0:
version "0.1.3"
resolved "https://registry.npmjs.org/yaml-language-server-parser/-/yaml-language-server-parser-0.1.3.tgz#f0e9082068291c7c330eefa1f3c9f1b4c3c54183"
integrity sha512-xD2I+6M/vqQvcy4ded8JpXUaDHXmZMdhIO3OpuiFxstutwnW4whrfDzNcrsfXVdgMWqOUpdv3747Q081PFN1+g==
yaml@^1.10.0, yaml@^1.7.2:
version "1.10.0"
resolved "https://registry.npmjs.org/yaml/-/yaml-1.10.0.tgz#3b593add944876077d4d683fee01081bd9fff31e"