mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Quick fixes monaco-editor error: "vs.editor.nullLanguage" (#21734)
fixes: https://github.com/go-gitea/gitea/issues/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 <i@sourcehut.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
		
							
								
								
									
										3
									
								
								web_src/js/bootstrap.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								web_src/js/bootstrap.js
									
									
									
									
										vendored
									
									
								
							@@ -26,9 +26,6 @@ function processWindowErrorEvent(e) {
 | 
				
			|||||||
    return; // ignore such nonsense error event
 | 
					    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.`);
 | 
					  showGlobalErrorMessage(`JavaScript error: ${e.message} (${e.filename} @ ${e.lineno}:${e.colno}). Open browser console to see more details.`);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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, {
 | 
					  const editor = monaco.editor.create(container, {
 | 
				
			||||||
    value: textarea.value,
 | 
					    value: textarea.value,
 | 
				
			||||||
    theme: 'gitea',
 | 
					    theme: 'gitea',
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user