Skip to content

Commit

Permalink
Quick fixes monaco-editor error: "vs.editor.nullLanguage" (#21734)
Browse files Browse the repository at this point in the history
fixes: #21733

Uncaught Error: Language id "vs.editor.nullLanguage" is not configured
nor known

Note that this monaco-editor worked fine on 0.33.0 and broke on 0.34.0.
If upstream fixed, remove this code.

Signed-off-by: Xinyu Zhou <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
  • Loading branch information
Xinyu Zhou and lunny authored Nov 9, 2022
1 parent 7e40cee commit dd7f1c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 0 additions & 3 deletions web_src/js/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.`);
}

Expand Down
4 changes: 4 additions & 0 deletions web_src/js/features/codeeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit dd7f1c0

Please sign in to comment.