diff options
author | A-Walrus | 2022-08-09 07:43:27 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2022-09-10 13:23:38 +0000 |
commit | 75e6a6432747eae6d2255afc52f20ced6902519b (patch) | |
tree | 14b99168cb50c65c9adbbd6181ee226dda7c4c70 /helix-view/src | |
parent | e8add6f46d0f208c96407151276a985dd34fc93f (diff) |
Switch to Result for invalid language
Diffstat (limited to 'helix-view/src')
-rw-r--r-- | helix-view/src/document.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 84c92320..8ebc9002 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -683,13 +683,12 @@ 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 + ) -> anyhow::Result<()> { + let language_config = config_loader + .language_config_for_language_id(language_id) + .ok_or_else(|| anyhow!("invalid language id: {}", language_id))?; + self.set_language(Some(language_config), Some(config_loader)); + Ok(()) } /// Set the LSP. |