aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-09-01 16:16:08 +0100
committerAleksey Kladov <[email protected]>2018-09-01 16:16:08 +0100
commite8515fecd7a42870f2979c7900c94b59d935901c (patch)
tree42ef7161eaa642f03e098cab29e7bf629686e07a
parent4268fbeaa1e9f98e033c72afce5dc8333da4b4b7 (diff)
split lib
-rw-r--r--crates/server/src/lib.rs34
-rw-r--r--crates/server/src/main.rs37
-rw-r--r--crates/server/src/main_loop/mod.rs2
3 files changed, 42 insertions, 31 deletions
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 @@
1#[macro_use]
2extern crate failure;
3#[macro_use]
4extern crate serde_derive;
5extern crate serde;
6extern crate serde_json;
7extern crate languageserver_types;
8#[macro_use]
9extern crate crossbeam_channel;
10extern crate threadpool;
11#[macro_use]
12extern crate log;
13extern crate drop_bomb;
14extern crate url_serde;
15extern crate walkdir;
16extern crate libeditor;
17extern crate libanalysis;
18extern crate libsyntax2;
19extern crate gen_lsp_server;
20extern crate im;
21extern crate relative_path;
22
23mod caps;
24mod req;
25mod conv;
26mod main_loop;
27mod vfs;
28mod path_map;
29mod server_world;
30
31pub type Result<T> = ::std::result::Result<T, ::failure::Error>;
32pub use caps::server_capabilities;
33pub use main_loop::main_loop;
34
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 @@
1#[macro_use] 1#[macro_use]
2extern crate failure;
3#[macro_use]
4extern crate serde_derive;
5extern crate serde;
6extern crate serde_json;
7extern crate languageserver_types;
8extern crate drop_bomb;
9#[macro_use]
10extern crate crossbeam_channel;
11extern crate threadpool;
12#[macro_use]
13extern crate log; 2extern crate log;
14extern crate url_serde; 3#[macro_use]
4extern crate failure;
15extern crate flexi_logger; 5extern crate flexi_logger;
16extern crate walkdir;
17extern crate libeditor;
18extern crate libanalysis;
19extern crate libsyntax2;
20extern crate gen_lsp_server; 6extern crate gen_lsp_server;
21extern crate im; 7extern crate m;
22extern crate relative_path;
23
24mod caps;
25mod req;
26mod conv;
27mod main_loop;
28mod vfs;
29mod path_map;
30mod server_world;
31 8
32use flexi_logger::{Logger, Duplicate}; 9use flexi_logger::{Logger, Duplicate};
33use gen_lsp_server::{run_server, stdio_transport}; 10use gen_lsp_server::{run_server, stdio_transport};
34 11use m::Result;
35pub type Result<T> = ::std::result::Result<T, ::failure::Error>;
36 12
37fn main() -> Result<()> { 13fn main() -> Result<()> {
38 Logger::with_env_or_str("m=error") 14 Logger::with_env_or_str("m=error")
@@ -57,8 +33,8 @@ fn main_inner() -> Result<()> {
57 let (receiver, sender, threads) = stdio_transport(); 33 let (receiver, sender, threads) = stdio_transport();
58 let root = ::std::env::current_dir()?; 34 let root = ::std::env::current_dir()?;
59 run_server( 35 run_server(
60 caps::server_capabilities(), 36 m::server_capabilities(),
61 |r, s| main_loop::main_loop(root, r, s), 37 |r, s| m::main_loop(root, r, s),
62 receiver, 38 receiver,
63 sender, 39 sender,
64 )?; 40 )?;
@@ -67,3 +43,4 @@ fn main_inner() -> Result<()> {
67 info!("... IO is down"); 43 info!("... IO is down");
68 Ok(()) 44 Ok(())
69} 45}
46
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 {
26 Notify(RawNotification), 26 Notify(RawNotification),
27} 27}
28 28
29pub(super) fn main_loop( 29pub fn main_loop(
30 root: PathBuf, 30 root: PathBuf,
31 msg_receriver: &mut Receiver<RawMessage>, 31 msg_receriver: &mut Receiver<RawMessage>,
32 msg_sender: &mut Sender<RawMessage>, 32 msg_sender: &mut Sender<RawMessage>,