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-term/src/commands | |
parent | e8add6f46d0f208c96407151276a985dd34fc93f (diff) |
Switch to Result for invalid language
Diffstat (limited to 'helix-term/src/commands')
-rw-r--r-- | helix-term/src/commands/typed.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 127eea0d..674ce7a6 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -1254,14 +1254,10 @@ fn language( let doc = doc_mut!(cx.editor); - let loader = cx.editor.syn_loader.clone(); if args[0] == "text" { - doc.set_language(None, Some(loader)) + doc.set_language(None, None) } else { - let ok = doc.set_language_by_language_id(&args[0], loader); - if !ok { - anyhow::bail!("invalid language: {}", args[0]); - } + doc.set_language_by_language_id(&args[0], cx.editor.syn_loader.clone())?; } doc.detect_indent_and_line_ending(); |