fix: properly print logs in nvim

This commit is contained in:
əlemi 2023-04-12 05:00:18 +02:00
parent 2fde9659db
commit a872c39d7f
3 changed files with 11 additions and 5 deletions

View file

@ -67,7 +67,13 @@ vim.api.nvim_create_user_command('Connect',
bin_args, bin_args,
{ {
rpc = true, 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 if M.jobid <= 0 then

View file

@ -238,18 +238,17 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
} }
let client = BufferClient::connect(args.host).await?; let client = BufferClient::connect(args.host).await?;
debug!("client connected");
let handler: NeovimHandler = NeovimHandler { let handler: NeovimHandler = NeovimHandler {
client: client.into(), 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? { if let Err(e) = io_handler.await? {
error!("[!] worker stopped with error: {}", e); error!("worker stopped with error: {}", e);
} }
Ok(()) Ok(())

View file

@ -132,6 +132,7 @@ impl CodempClient {
pub fn detach(&mut self, path: String) { pub fn detach(&mut self, path: String) {
self.factories.write().unwrap().remove(&path); self.factories.write().unwrap().remove(&path);
info!("|| detached from buffer");
} }
async fn sync(&mut self, path: String) -> Result<String, Status> { async fn sync(&mut self, path: String) -> Result<String, Status> {