diff options
author | Aleksey Kladov <[email protected]> | 2018-09-01 16:16:08 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-09-01 16:16:08 +0100 |
commit | e8515fecd7a42870f2979c7900c94b59d935901c (patch) | |
tree | 42ef7161eaa642f03e098cab29e7bf629686e07a /crates/server | |
parent | 4268fbeaa1e9f98e033c72afce5dc8333da4b4b7 (diff) |
split lib
Diffstat (limited to 'crates/server')
-rw-r--r-- | crates/server/src/lib.rs | 34 | ||||
-rw-r--r-- | crates/server/src/main.rs | 37 | ||||
-rw-r--r-- | crates/server/src/main_loop/mod.rs | 2 |
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] | ||
2 | extern crate failure; | ||
3 | #[macro_use] | ||
4 | extern crate serde_derive; | ||
5 | extern crate serde; | ||
6 | extern crate serde_json; | ||
7 | extern crate languageserver_types; | ||
8 | #[macro_use] | ||
9 | extern crate crossbeam_channel; | ||
10 | extern crate threadpool; | ||
11 | #[macro_use] | ||
12 | extern crate log; | ||
13 | extern crate drop_bomb; | ||
14 | extern crate url_serde; | ||
15 | extern crate walkdir; | ||
16 | extern crate libeditor; | ||
17 | extern crate libanalysis; | ||
18 | extern crate libsyntax2; | ||
19 | extern crate gen_lsp_server; | ||
20 | extern crate im; | ||
21 | extern crate relative_path; | ||
22 | |||
23 | mod caps; | ||
24 | mod req; | ||
25 | mod conv; | ||
26 | mod main_loop; | ||
27 | mod vfs; | ||
28 | mod path_map; | ||
29 | mod server_world; | ||
30 | |||
31 | pub type Result<T> = ::std::result::Result<T, ::failure::Error>; | ||
32 | pub use caps::server_capabilities; | ||
33 | pub 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] |
2 | extern crate failure; | ||
3 | #[macro_use] | ||
4 | extern crate serde_derive; | ||
5 | extern crate serde; | ||
6 | extern crate serde_json; | ||
7 | extern crate languageserver_types; | ||
8 | extern crate drop_bomb; | ||
9 | #[macro_use] | ||
10 | extern crate crossbeam_channel; | ||
11 | extern crate threadpool; | ||
12 | #[macro_use] | ||
13 | extern crate log; | 2 | extern crate log; |
14 | extern crate url_serde; | 3 | #[macro_use] |
4 | extern crate failure; | ||
15 | extern crate flexi_logger; | 5 | extern crate flexi_logger; |
16 | extern crate walkdir; | ||
17 | extern crate libeditor; | ||
18 | extern crate libanalysis; | ||
19 | extern crate libsyntax2; | ||
20 | extern crate gen_lsp_server; | 6 | extern crate gen_lsp_server; |
21 | extern crate im; | 7 | extern crate m; |
22 | extern crate relative_path; | ||
23 | |||
24 | mod caps; | ||
25 | mod req; | ||
26 | mod conv; | ||
27 | mod main_loop; | ||
28 | mod vfs; | ||
29 | mod path_map; | ||
30 | mod server_world; | ||
31 | 8 | ||
32 | use flexi_logger::{Logger, Duplicate}; | 9 | use flexi_logger::{Logger, Duplicate}; |
33 | use gen_lsp_server::{run_server, stdio_transport}; | 10 | use gen_lsp_server::{run_server, stdio_transport}; |
34 | 11 | use m::Result; | |
35 | pub type Result<T> = ::std::result::Result<T, ::failure::Error>; | ||
36 | 12 | ||
37 | fn main() -> Result<()> { | 13 | fn 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 | ||
29 | pub(super) fn main_loop( | 29 | pub 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>, |