For single-file worktrees start LSP with parent dir as CWD

This commit is contained in:
Max Brunsfeld 2022-03-10 16:06:12 -08:00
parent 44a68b723c
commit 9a6819b899

View File

@ -109,8 +109,13 @@ impl LanguageServer {
options: Option<Value>, options: Option<Value>,
background: Arc<executor::Background>, background: Arc<executor::Background>,
) -> Result<Self> { ) -> Result<Self> {
let working_dir = if root_path.is_dir() {
root_path
} else {
root_path.parent().unwrap_or(Path::new("/"))
};
let mut server = Command::new(binary_path) let mut server = Command::new(binary_path)
.current_dir(root_path) .current_dir(working_dir)
.args(args) .args(args)
.stdin(Stdio::piped()) .stdin(Stdio::piped())
.stdout(Stdio::piped()) .stdout(Stdio::piped())