From e8515fecd7a42870f2979c7900c94b59d935901c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 1 Sep 2018 18:16:08 +0300 Subject: split lib --- crates/server/src/lib.rs | 34 ++++++++++++++++++++++++++++++++++ crates/server/src/main.rs | 37 +++++++------------------------------ crates/server/src/main_loop/mod.rs | 2 +- 3 files changed, 42 insertions(+), 31 deletions(-) create mode 100644 crates/server/src/lib.rs diff --git a/crates/server/src/lib.rs b/crates/server/src/lib.rs new file mode 100644 index 000000000..5bbd21044 --- /dev/null +++ b/crates/server/src/lib.rs @@ -0,0 +1,34 @@ +#[macro_use] +extern crate failure; +#[macro_use] +extern crate serde_derive; +extern crate serde; +extern crate serde_json; +extern crate languageserver_types; +#[macro_use] +extern crate crossbeam_channel; +extern crate threadpool; +#[macro_use] +extern crate log; +extern crate drop_bomb; +extern crate url_serde; +extern crate walkdir; +extern crate libeditor; +extern crate libanalysis; +extern crate libsyntax2; +extern crate gen_lsp_server; +extern crate im; +extern crate relative_path; + +mod caps; +mod req; +mod conv; +mod main_loop; +mod vfs; +mod path_map; +mod server_world; + +pub type Result = ::std::result::Result; +pub use caps::server_capabilities; +pub use main_loop::main_loop; + diff --git a/crates/server/src/main.rs b/crates/server/src/main.rs index ecc1f58f8..119f020d3 100644 --- a/crates/server/src/main.rs +++ b/crates/server/src/main.rs @@ -1,38 +1,14 @@ #[macro_use] -extern crate failure; -#[macro_use] -extern crate serde_derive; -extern crate serde; -extern crate serde_json; -extern crate languageserver_types; -extern crate drop_bomb; -#[macro_use] -extern crate crossbeam_channel; -extern crate threadpool; -#[macro_use] extern crate log; -extern crate url_serde; +#[macro_use] +extern crate failure; extern crate flexi_logger; -extern crate walkdir; -extern crate libeditor; -extern crate libanalysis; -extern crate libsyntax2; extern crate gen_lsp_server; -extern crate im; -extern crate relative_path; - -mod caps; -mod req; -mod conv; -mod main_loop; -mod vfs; -mod path_map; -mod server_world; +extern crate m; use flexi_logger::{Logger, Duplicate}; use gen_lsp_server::{run_server, stdio_transport}; - -pub type Result = ::std::result::Result; +use m::Result; fn main() -> Result<()> { Logger::with_env_or_str("m=error") @@ -57,8 +33,8 @@ fn main_inner() -> Result<()> { let (receiver, sender, threads) = stdio_transport(); let root = ::std::env::current_dir()?; run_server( - caps::server_capabilities(), - |r, s| main_loop::main_loop(root, r, s), + m::server_capabilities(), + |r, s| m::main_loop(root, r, s), receiver, sender, )?; @@ -67,3 +43,4 @@ fn main_inner() -> Result<()> { info!("... IO is down"); Ok(()) } + diff --git a/crates/server/src/main_loop/mod.rs b/crates/server/src/main_loop/mod.rs index 75d65dcbf..610aa4264 100644 --- a/crates/server/src/main_loop/mod.rs +++ b/crates/server/src/main_loop/mod.rs @@ -26,7 +26,7 @@ enum Task { Notify(RawNotification), } -pub(super) fn main_loop( +pub fn main_loop( root: PathBuf, msg_receriver: &mut Receiver, msg_sender: &mut Sender, -- cgit v1.2.3