mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
split lib
This commit is contained in:
parent
4268fbeaa1
commit
e8515fecd7
3 changed files with 42 additions and 31 deletions
34
crates/server/src/lib.rs
Normal file
34
crates/server/src/lib.rs
Normal file
|
@ -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<T> = ::std::result::Result<T, ::failure::Error>;
|
||||||
|
pub use caps::server_capabilities;
|
||||||
|
pub use main_loop::main_loop;
|
||||||
|
|
|
@ -1,38 +1,14 @@
|
||||||
#[macro_use]
|
#[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 log;
|
||||||
extern crate url_serde;
|
#[macro_use]
|
||||||
|
extern crate failure;
|
||||||
extern crate flexi_logger;
|
extern crate flexi_logger;
|
||||||
extern crate walkdir;
|
|
||||||
extern crate libeditor;
|
|
||||||
extern crate libanalysis;
|
|
||||||
extern crate libsyntax2;
|
|
||||||
extern crate gen_lsp_server;
|
extern crate gen_lsp_server;
|
||||||
extern crate im;
|
extern crate m;
|
||||||
extern crate relative_path;
|
|
||||||
|
|
||||||
mod caps;
|
|
||||||
mod req;
|
|
||||||
mod conv;
|
|
||||||
mod main_loop;
|
|
||||||
mod vfs;
|
|
||||||
mod path_map;
|
|
||||||
mod server_world;
|
|
||||||
|
|
||||||
use flexi_logger::{Logger, Duplicate};
|
use flexi_logger::{Logger, Duplicate};
|
||||||
use gen_lsp_server::{run_server, stdio_transport};
|
use gen_lsp_server::{run_server, stdio_transport};
|
||||||
|
use m::Result;
|
||||||
pub type Result<T> = ::std::result::Result<T, ::failure::Error>;
|
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
Logger::with_env_or_str("m=error")
|
Logger::with_env_or_str("m=error")
|
||||||
|
@ -57,8 +33,8 @@ fn main_inner() -> Result<()> {
|
||||||
let (receiver, sender, threads) = stdio_transport();
|
let (receiver, sender, threads) = stdio_transport();
|
||||||
let root = ::std::env::current_dir()?;
|
let root = ::std::env::current_dir()?;
|
||||||
run_server(
|
run_server(
|
||||||
caps::server_capabilities(),
|
m::server_capabilities(),
|
||||||
|r, s| main_loop::main_loop(root, r, s),
|
|r, s| m::main_loop(root, r, s),
|
||||||
receiver,
|
receiver,
|
||||||
sender,
|
sender,
|
||||||
)?;
|
)?;
|
||||||
|
@ -67,3 +43,4 @@ fn main_inner() -> Result<()> {
|
||||||
info!("... IO is down");
|
info!("... IO is down");
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ enum Task {
|
||||||
Notify(RawNotification),
|
Notify(RawNotification),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn main_loop(
|
pub fn main_loop(
|
||||||
root: PathBuf,
|
root: PathBuf,
|
||||||
msg_receriver: &mut Receiver<RawMessage>,
|
msg_receriver: &mut Receiver<RawMessage>,
|
||||||
msg_sender: &mut Sender<RawMessage>,
|
msg_sender: &mut Sender<RawMessage>,
|
||||||
|
|
Loading…
Reference in a new issue