aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/document.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-view/src/document.rs')
-rw-r--r--helix-view/src/document.rs13
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.