From b7cb7f3104da7c5c35e4bb3c0729ca20193eabb1 Mon Sep 17 00:00:00 2001 From: MDeiml Date: Mon, 27 Feb 2023 13:06:59 +0100 Subject: [PATCH] Fix bug with positional encoding --- helix-term/src/application.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index c8e8ecb1ae61f..f5c48fe82152b 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -967,6 +967,14 @@ impl Application { } }; + let offset_encoding = match self.editor.language_servers.get_by_id(server_id) { + Some(language_server) => language_server.offset_encoding(), + None => { + warn!("can't find language server with id `{}`", server_id); + return; + } + }; + let reply = match call { MethodCall::WorkDoneProgressCreate(params) => { self.lsp_progress.create(server_id, params.token); @@ -983,11 +991,7 @@ impl Application { Ok(serde_json::Value::Null) } MethodCall::ApplyWorkspaceEdit(params) => { - apply_workspace_edit( - &mut self.editor, - helix_lsp::OffsetEncoding::Utf8, - ¶ms.edit, - ); + apply_workspace_edit(&mut self.editor, offset_encoding, ¶ms.edit); Ok(json!(lsp::ApplyWorkspaceEditResponse { applied: true,