Skip to content

Commit

Permalink
improve error message when spawning language server fails with more c…
Browse files Browse the repository at this point in the history
…ontext
  • Loading branch information
pr2502 committed Jul 29, 2024
1 parent dc96d7e commit 247736b
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/instance.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::collections::hash_map::Entry;
use std::collections::{BTreeMap, HashMap, HashSet};
use std::env;
use std::io::ErrorKind;
use std::ops::Deref;
use std::path::Path;
Expand Down Expand Up @@ -431,9 +432,22 @@ async fn spawn(
.stderr(Stdio::piped())
.spawn()
.with_context(|| {
let InstanceKey {
server,
args,
env,
workspace_root,
} = &key;
let path = env
.get("PATH")
.map(<_>::to_owned)
// Display PATH from our environment Command will if none was
// passed from the client environment.
.or_else(|| env::var("PATH").ok())
.unwrap_or_default();
format!(
"spawning langauge server: server={:?}, args={:?}, cwd={:?}",
key.server, key.args, key.workspace_root,
"spawning langauge server: server={server:?}, args={args:?}, \
cwd={workspace_root:?}, path={path:?}, env={env:?}",
)
})?;

Expand Down

0 comments on commit 247736b

Please sign in to comment.