From 47e8b80e9b67d5012fbc860a7763975e99fdf28d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 5 Sep 2018 21:38:43 +0300 Subject: use correct workdir for the server --- crates/server/src/main.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'crates/server/src') diff --git a/crates/server/src/main.rs b/crates/server/src/main.rs index 5c0166a61..baabde629 100644 --- a/crates/server/src/main.rs +++ b/crates/server/src/main.rs @@ -31,10 +31,15 @@ fn main() -> Result<()> { fn main_inner() -> Result<()> { let (receiver, sender, threads) = stdio_transport(); - let root = ::std::env::current_dir()?; + let cwd = ::std::env::current_dir()?; run_server( m::server_capabilities(), - |r, s| m::main_loop(false, root, r, s), + |params, r, s| { + let root = params.root_uri + .and_then(|it| it.to_file_path().ok()) + .unwrap_or(cwd); + m::main_loop(false, root, r, s) + }, receiver, sender, )?; -- cgit v1.2.3