From c3f9d3641cd079cce1ce6d51c62e32f80fdb56df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Mon, 28 Mar 2022 16:22:50 +0900 Subject: [PATCH] fix helix-term build --- helix-term/Cargo.toml | 7 ++++--- helix-term/src/application.rs | 19 +++++++++++-------- helix-view/src/document.rs | 3 ++- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml index 6ddb81648..cd4973ad3 100644 --- a/helix-term/Cargo.toml +++ b/helix-term/Cargo.toml @@ -16,8 +16,9 @@ build = true app = true [features] -# default = ["dap"] +default = ["dap", "lsp"] dap = ["helix-dap", "helix-view/dap"] +lsp = ["helix-lsp", "helix-view/lsp"] unicode-lines = ["helix-core/unicode-lines"] [[bin]] @@ -26,8 +27,8 @@ path = "src/main.rs" [dependencies] helix-core = { version = "0.6", path = "../helix-core" } -helix-view = { version = "0.6", path = "../helix-view" } -helix-lsp = { version = "0.6", path = "../helix-lsp" } +helix-view = { version = "0.6", path = "../helix-view", features = ["term"] } +helix-lsp = { version = "0.6", path = "../helix-lsp", optional = true } helix-dap = { version = "0.6", path = "../helix-dap", optional = true } helix-loader = { version = "0.6", path = "../helix-loader" } diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 22c75336a..82fdb0685 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -415,14 +415,17 @@ pub async fn handle_language_server_message( match notification { Notification::Initialized => { - let language_server = - match self.editor.language_servers.get_by_id(server_id) { - Some(language_server) => language_server, - None => { - warn!("can't find language server with id `{}`", server_id); - return; - } - }; + let language_server = match self + .editor + .language_servers + .get_by_id(server_id) + { + Some(language_server) => language_server, + None => { + log::warn!("can't find language server with id `{}`", server_id); + return; + } + }; // Trigger a workspace/didChangeConfiguration notification after initialization. // This might not be required by the spec but Neovim does this as well, so it's diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index b0e5306d3..ac1f3d403 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -264,11 +264,12 @@ pub fn from_reader( /// Encodes the text inside `rope` into the given `encoding` and writes the /// encoded output into `writer.` As a `Rope` can only contain valid UTF-8, /// replacement characters may appear in the encoded text. -pub async fn to_writer<'a, W: tokio::io::AsyncWriteExt + Unpin + ?Sized>( +pub async fn to_writer<'a, W: tokio::io::AsyncWrite + Unpin + ?Sized>( writer: &'a mut W, encoding: &'static encoding::Encoding, rope: &'a Rope, ) -> Result<(), Error> { + use tokio::io::AsyncWriteExt; // Text inside a `Rope` is stored as non-contiguous blocks of data called // chunks. The absolute size of each chunk is unknown, thus it is impossible // to predict the end of the chunk iterator ahead of time. Instead, it is