mirror of
https://github.com/hexedtech/codemp-vscode.git
synced 2024-12-23 13:54:55 +01:00
feat: made nvim client a feature (for now, enabled by default)
This commit is contained in:
parent
2195cb28b8
commit
ede7a7758c
2 changed files with 9 additions and 23 deletions
|
@ -3,6 +3,10 @@ name = "codemp"
|
|||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
default = ["nvim"]
|
||||
nvim = []
|
||||
|
||||
[[bin]] # Bin to run the CodeMP gRPC server
|
||||
name = "codemp-server"
|
||||
path = "src/server/main.rs"
|
||||
|
|
|
@ -1,32 +1,14 @@
|
|||
pub mod manager;
|
||||
mod nvim;
|
||||
|
||||
use tokio::sync::mpsc;
|
||||
use nvim_rs::create::tokio::new_parent;
|
||||
|
||||
use manager::ConnectionManager;
|
||||
use nvim::NeovimHandler;
|
||||
pub mod proto { tonic::include_proto!("workspace"); }
|
||||
use proto::workspace_client::WorkspaceClient;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<(dyn std::error::Error + 'static)>> {
|
||||
let (tx, rx) = mpsc::channel(32);
|
||||
let client = WorkspaceClient::connect("http://[::1]:50051").await?;
|
||||
|
||||
//nvim stuff
|
||||
let handler: NeovimHandler = NeovimHandler::new(tx).await?;
|
||||
let (_nvim, io_handler) = new_parent(handler).await;
|
||||
|
||||
// nvim.call(":echo", vec![Value::from("'***REMOVED***'")]).await.unwrap();
|
||||
let mut mngr = ConnectionManager::new("http://[::1]:50051".to_string(), rx).await?;
|
||||
let _task = tokio::spawn(async move {
|
||||
mngr.process_packets().await
|
||||
});
|
||||
|
||||
// Any error should probably be logged, as stderr is not visible to users.
|
||||
match io_handler.await {
|
||||
Err(err) => eprintln!("Error joining IO loop: {:?}", err),
|
||||
Ok(Err(err)) => eprintln!("Process ended with error: {:?}", err),
|
||||
Ok(Ok(())) => eprintln!("Finished"),
|
||||
}
|
||||
#[cfg(feature = "nvim")]
|
||||
crate::nvim::run_nvim_client(client).await.unwrap();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue