From ba3874f309baf7a681d20f72d8ab54c7d3a1876f Mon Sep 17 00:00:00 2001 From: keith Date: Wed, 29 Jan 2020 23:17:16 -0800 Subject: [PATCH] version error --- src/bridge/mod.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/bridge/mod.rs b/src/bridge/mod.rs index c6c68c3..eb5984d 100644 --- a/src/bridge/mod.rs +++ b/src/bridge/mod.rs @@ -7,7 +7,7 @@ use std::sync::Arc; use std::process::Stdio; use rmpv::Value; -use nvim_rs::{create::tokio as create, UiAttachOptions}; +use nvim_rs::{create::tokio as create, UiAttachOptions, neovim_api}; use tokio::runtime::Runtime; use tokio::process::Command; use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender}; @@ -71,6 +71,16 @@ async fn start_process(mut receiver: UnboundedReceiver) { std::process::exit(0); }); + if let Ok(Value::Integer(correct_version)) = nvim.eval("has(\"nvim-0.4\")").await { + if correct_version.as_i64() != Some(1) { + println!("Neovide requires version 0.4 or higher"); + std::process::exit(0); + } + } else { + println!("Neovide requires version 0.4 or higher"); + std::process::exit(0); + } + nvim.set_var("neovide", Value::Boolean(true)).await .unwrap_or_explained_panic("Could not communicate.", "Could not communicate with neovim process"); let mut options = UiAttachOptions::new();