From e8add6f46d0f208c96407151276a985dd34fc93f Mon Sep 17 00:00:00 2001 From: A-Walrus Date: Mon, 8 Aug 2022 22:04:41 +0300 Subject: Add error handling to set language command If you type a nonexistant language an appropriate message will show, and the language won't be changed. --- helix-view/src/document.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'helix-view/src') diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index a0d50440..84c92320 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -683,9 +683,13 @@ impl Document { &mut self, language_id: &str, config_loader: Arc, - ) { + ) -> bool { let language_config = config_loader.language_config_for_language_id(language_id); + if language_config.is_none() { + return false; + } self.set_language(language_config, Some(config_loader)); + true } /// Set the LSP. -- cgit v1.2.3-70-g09d2