From cea7458c79f74805f384ea721c2fd2a7517284a0 Mon Sep 17 00:00:00 2001 From: Xinyu Zhou Date: Wed, 9 Nov 2022 13:34:55 +0800 Subject: [PATCH 1/2] Quick fixes monaco-editor error: "vs.editor.nullLanguage" fixes: https://github.com/go-gitea/gitea/issues/21733 Uncaught Error: Language id "vs.editor.nullLanguage" is not configured nor known Signed-off-by: Xinyu Zhou --- web_src/js/bootstrap.js | 3 --- web_src/js/features/codeeditor.js | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/web_src/js/bootstrap.js b/web_src/js/bootstrap.js index b5db3985456e0..54b7c628873e5 100644 --- a/web_src/js/bootstrap.js +++ b/web_src/js/bootstrap.js @@ -26,9 +26,6 @@ function processWindowErrorEvent(e) { return; // ignore such nonsense error event } - // Wait for upstream fix: https://github.com/microsoft/monaco-editor/issues/2962 - if (e.message.includes('Language id "vs.editor.nullLanguage" is not configured nor known')) return; - showGlobalErrorMessage(`JavaScript error: ${e.message} (${e.filename} @ ${e.lineno}:${e.colno}). Open browser console to see more details.`); } diff --git a/web_src/js/features/codeeditor.js b/web_src/js/features/codeeditor.js index 0366afc2c092d..4050198f2edc8 100644 --- a/web_src/js/features/codeeditor.js +++ b/web_src/js/features/codeeditor.js @@ -99,6 +99,10 @@ export async function createMonaco(textarea, filename, editorOpts) { } }); + // Quick fix: https://github.com/microsoft/monaco-editor/issues/2962 + monaco.languages.register({id: 'vs.editor.nullLanguage'}) + monaco.languages.setLanguageConfiguration('vs.editor.nullLanguage', {}) + const editor = monaco.editor.create(container, { value: textarea.value, theme: 'gitea', From 09a3ab5e0f19fbde1d77fb519e5d35384b3e6388 Mon Sep 17 00:00:00 2001 From: Xinyu Zhou Date: Wed, 9 Nov 2022 13:46:16 +0800 Subject: [PATCH 2/2] lint Signed-off-by: Xinyu Zhou --- web_src/js/features/codeeditor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web_src/js/features/codeeditor.js b/web_src/js/features/codeeditor.js index 4050198f2edc8..23a26ba2b0d80 100644 --- a/web_src/js/features/codeeditor.js +++ b/web_src/js/features/codeeditor.js @@ -100,8 +100,8 @@ export async function createMonaco(textarea, filename, editorOpts) { }); // Quick fix: https://github.com/microsoft/monaco-editor/issues/2962 - monaco.languages.register({id: 'vs.editor.nullLanguage'}) - monaco.languages.setLanguageConfiguration('vs.editor.nullLanguage', {}) + monaco.languages.register({id: 'vs.editor.nullLanguage'}); + monaco.languages.setLanguageConfiguration('vs.editor.nullLanguage', {}); const editor = monaco.editor.create(container, { value: textarea.value,