diff options
author | A-Walrus | 2022-08-08 19:04:41 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2022-09-10 13:23:38 +0000 |
commit | e8add6f46d0f208c96407151276a985dd34fc93f (patch) | |
tree | 1370a1025e543b6e0019946d699217c4b504d8a2 /helix-view/src | |
parent | cc47d3fb9d048b7fe2546409a492f27f6199adf5 (diff) |
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.
Diffstat (limited to 'helix-view/src')
-rw-r--r-- | helix-view/src/document.rs | 6 |
1 files changed, 5 insertions, 1 deletions
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<syntax::Loader>, - ) { + ) -> 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. |