From a872c39d7f0b714c1bfa7b7e7b8d474f9c7dfc69 Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 12 Apr 2023 05:00:18 +0200 Subject: [PATCH] fix: properly print logs in nvim --- src/client/nvim/codemp.lua | 8 +++++++- src/client/nvim/main.rs | 7 +++---- src/lib/client.rs | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/client/nvim/codemp.lua b/src/client/nvim/codemp.lua index 3e75531..6f3f35b 100644 --- a/src/client/nvim/codemp.lua +++ b/src/client/nvim/codemp.lua @@ -67,7 +67,13 @@ vim.api.nvim_create_user_command('Connect', bin_args, { rpc = true, - on_stderr = function(_, data, _) print(vim.fn.join(data, "\n")) end, + on_stderr = function(_, data, _) + for _, line in pairs(data) do + print(line) + end + -- print(vim.fn.join(data, "\n")) + end, + stderr_buffered = false, } ) if M.jobid <= 0 then diff --git a/src/client/nvim/main.rs b/src/client/nvim/main.rs index 6ec0362..737053b 100644 --- a/src/client/nvim/main.rs +++ b/src/client/nvim/main.rs @@ -238,18 +238,17 @@ async fn main() -> Result<(), Box> { } let client = BufferClient::connect(args.host).await?; - debug!("client connected"); let handler: NeovimHandler = NeovimHandler { client: client.into(), }; - let (nvim, io_handler) = create::new_parent(handler).await; + let (_nvim, io_handler) = create::new_parent(handler).await; - nvim.out_write("[*] codemp loaded").await?; + info!("++ codemp started"); if let Err(e) = io_handler.await? { - error!("[!] worker stopped with error: {}", e); + error!("worker stopped with error: {}", e); } Ok(()) diff --git a/src/lib/client.rs b/src/lib/client.rs index 64e5d07..f2ecb1d 100644 --- a/src/lib/client.rs +++ b/src/lib/client.rs @@ -132,6 +132,7 @@ impl CodempClient { pub fn detach(&mut self, path: String) { self.factories.write().unwrap().remove(&path); + info!("|| detached from buffer"); } async fn sync(&mut self, path: String) -> Result {