aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src/commands.rs')
-rw-r--r--helix-term/src/commands.rs29
1 files changed, 19 insertions, 10 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 5b44775b..8af5a7e3 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -3801,15 +3801,21 @@ fn format_selections(cx: &mut Context) {
let range = ranges[0];
- let edits = tokio::task::block_in_place(|| {
- helix_lsp::block_on(language_server.text_document_range_formatting(
- doc.identifier(),
- range,
- lsp::FormattingOptions::default(),
- None,
- ))
- })
- .unwrap_or_default();
+ let request = match language_server.text_document_range_formatting(
+ doc.identifier(),
+ range,
+ lsp::FormattingOptions::default(),
+ None,
+ ) {
+ Some(future) => future,
+ None => {
+ cx.editor
+ .set_error("Language server does not support range formatting");
+ return;
+ }
+ };
+
+ let edits = tokio::task::block_in_place(|| helix_lsp::block_on(request)).unwrap_or_default();
let transaction = helix_lsp::util::generate_transaction_from_edits(
doc.text(),
@@ -3953,7 +3959,10 @@ pub fn completion(cx: &mut Context) {
let pos = pos_to_lsp_pos(doc.text(), cursor, offset_encoding);
- let future = language_server.completion(doc.identifier(), pos, None);
+ let future = match language_server.completion(doc.identifier(), pos, None) {
+ Some(future) => future,
+ None => return,
+ };
let trigger_offset = cursor;