use correct workdir for the server

This commit is contained in:
Aleksey Kladov
2018-09-05 21:38:43 +03:00
parent 529ebd5840
commit 47e8b80e9b
2 changed files with 19 additions and 10 deletions

View File

@@ -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,
)?;